prysm-pulse/fuzz/BUILD.bazel
terence tsao cc773a1641
Rm unused HashTreeRootState (#6697)
* Remove hash tree root implementations

* Delete benchmark tests

* Update existing tests

* Gaz

* Remove outdated ssz cache fuzz test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-07-23 17:19:05 -05:00

258 lines
8.4 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")
# gazelle:ignore generated.ssz.go
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",
":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 = "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",
"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
)