prysm-pulse/fuzz/BUILD.bazel
Preston Van Loon eb2abbdd8b
libfuzz based tests (#5095)
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* use opt for fuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* use ubuntu as the default build image
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Move fuzz tests
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* making progress on p2p fuzz
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* use a single stream repeatedly
* use a single stream repeatedly
* use many streams
* fixes
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Add basic test for ssz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge branch 'master' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Use a custom go_library to add libfuzzer
* delete old corpus, fix rpc_status_fuzz
* move fuzz.bzl
* minor fixes
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* add c-shared library (doesnt work)
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* fix build
* fixes
* Merge refs/heads/master into go-1.14-libfuzz
* lint
* more lint
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* more lint
* allow environment variable
* Merge refs/heads/master into go-1.14-libfuzz
* Add a fuzzit image with the beacon_states
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* lint
* readme
* lint
* fix lint again i think
* gaz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* breakup deps
* Merge branch 'go-1.14-libfuzz' of github.com:prysmaticlabs/prysm into go-1.14-libfuzz
* don't panic on failure
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* panic if no beacon states to read
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* update rules_foreign_cc
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* remove c_shared target, manually tag tests
* Add readme to fuzz package
* delete a few comments
* delete a few comments
* lint
* gaz
* gaz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
* Merge refs/heads/master into go-1.14-libfuzz
2020-05-05 07:22:26 +00:00

273 lines
8.9 KiB
Python

load("@prysm//tools/go:def.bzl", "go_library")
load("//tools/go:fuzz.bzl", "go_fuzz_test")
load("@com_github_prysmaticlabs_ethereumapis//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")
load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push")
ssz_gen_marshal(
name = "ssz_generated_files",
srcs = ["inputs.go"],
includes = [
"//proto/beacon/p2p/v1:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
],
objs = [
"InputBlockHeader",
"InputAttesterSlashingWrapper",
"InputAttestationWrapper",
"InputDepositWrapper",
"InputVoluntaryExitWrapper",
"InputProposerSlashingWrapper",
],
)
container_image(
name = "prysm_fuzzit",
base = "@fuzzit_base//image",
directory = "/beacon_states",
env = {
"BEACONSTATES_PATH": "/beacon_states",
},
files = [
"@sigp_beacon_fuzz_corpora//:current_mainnet_beaconstate",
],
)
container_push(
name = "push_image",
format = "Docker",
image = ":prysm_fuzzit",
registry = "gcr.io",
repository = "prysmaticlabs/prysm-fuzzit",
tag = "v0.11.0",
)
IMPORT_PATH = "github.com/prysmaticlabs/prysm/fuzz"
COMMON_DEPS = [
"//beacon-chain/state:go_default_library",
"//shared/featureconfig:go_default_library",
"@com_github_prysmaticlabs_go_ssz//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
] + SSZ_DEPS
COMMON_SRCS = [
"common.go",
"inputs.go",
":ssz_generated_files",
]
SRCS = COMMON_SRCS + glob(["*_fuzz.go"])
test_suite(
name = "fuzz_tests",
tags = ["manual"],
tests = [
":attestation_fuzz_test_with_libfuzzer",
":attester_slashing_fuzz_test_with_libfuzzer",
":block_fuzz_test_with_libfuzzer",
":block_header_fuzz_test_with_libfuzzer",
":deposit_fuzz_test_with_libfuzzer",
":proposer_slashing_fuzz_test_with_libfuzzer",
":rpc_status_fuzz_test_with_libfuzzer",
":ssz_cache_fuzz_test_with_libfuzzer",
":voluntary_exit_fuzz_test_with_libfuzzer",
],
)
go_fuzz_test(
name = "attestation_fuzz_test",
srcs = [
"attestation_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:current_mainnet_attestation",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/attestation",
func = "BeaconFuzzAttestation",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "attester_slashing_fuzz_test",
srcs = [
"attester_slashing_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:current_mainnet_attester_slashing",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/attester_slashing",
func = "BeaconFuzzAttesterSlashing",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "block_fuzz_test",
srcs = [
"block_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:current_mainnet_block_header",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/block_header",
func = "BeaconFuzzBlock",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "block_header_fuzz_test",
srcs = [
"block_header_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:current_mainnet_block_header",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/block_header",
func = "BeaconFuzzBlockHeader",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "deposit_fuzz_test",
srcs = [
"deposit_fuzz.go",
] + COMMON_SRCS,
corpus = "deposit_corpus",
corpus_path = "fuzz/deposit_corpus",
func = "BeaconFuzzDeposit",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "proposer_slashing_fuzz_test",
srcs = [
"proposer_slashing_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:current_mainnet_proposer_slashing",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/proposer_slashing",
func = "BeaconFuzzProposerSlashing",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "rpc_status_fuzz_test",
srcs = [
"rpc_status_fuzz.go",
] + COMMON_SRCS,
corpus = "rpc_status_corpus",
corpus_path = "fuzz/rpc_status_corpus",
func = "BeaconFuzzP2PRPCStatus",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/p2p:go_default_library",
"//beacon-chain/sync:go_default_library",
"//beacon-chain/blockchain/testing:go_default_library",
"//beacon-chain/sync/initial-sync/testing:go_default_library",
"//beacon-chain/cache:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_libp2p_go_libp2p//:go_default_library",
"@com_github_libp2p_go_libp2p_core//host:go_default_library",
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
"@com_github_libp2p_go_libp2p_core//mux:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "ssz_cache_fuzz_test",
srcs = [
"ssz_cache_fuzz.go",
] + COMMON_SRCS,
corpus = "@sigp_beacon_fuzz_corpora//:0_11_0_mainnet_beaconstate",
corpus_path = "external/sigp_beacon_fuzz_corpora/0-11-0/mainnet/beaconstate",
func = "BeaconFuzzSSZCache",
importpath = IMPORT_PATH,
deps = [
"//proto/beacon/p2p/v1:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
] + COMMON_DEPS,
)
go_fuzz_test(
name = "voluntary_exit_fuzz_test",
srcs = [
"voluntary_exit_fuzz.go",
] + COMMON_SRCS,
corpus = "voluntary_exit_corpus",
corpus_path = "fuzz/voluntary_exit_corpus",
func = "BeaconFuzzVoluntaryExit",
importpath = IMPORT_PATH,
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//fuzz/testing:go_default_library",
"//shared/params:go_default_library",
] + COMMON_DEPS,
)
go_library(
name = "go_default_library",
testonly = 1,
srcs = [
"attestation_fuzz.go",
"attester_slashing_fuzz.go",
"block_fuzz.go",
"block_header_fuzz.go",
"common.go",
"deposit_fuzz.go",
"inputs.go",
"rpc_status_fuzz.go",
"ssz_cache_fuzz.go",
"voluntary_exit_fuzz.go",
":ssz_generated_files", # keep
],
importpath = "github.com/prysmaticlabs/prysm/fuzz",
visibility = ["//visibility:public"],
deps = [
"//beacon-chain/blockchain/testing:go_default_library",
"//beacon-chain/cache:go_default_library",
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/p2p:go_default_library",
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
"//beacon-chain/sync:go_default_library",
"//beacon-chain/sync/initial-sync/testing:go_default_library",
"//fuzz/testing:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"@com_github_libp2p_go_libp2p//:go_default_library",
"@com_github_libp2p_go_libp2p_core//host:go_default_library",
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@com_github_prysmaticlabs_go_ssz//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
] + SSZ_DEPS, # keep
)