Move spectests into a separate package (#8798)

* move general/phase0/bls tests

* phase0/operations tests

* phase0/sanity/blocks

* fix import

* phase0/sanity/slots

* phase0/sanity/slots minimal

* phase0/epoch_processing tests

* phase0/rewards tests

* simplify

* more simplification

* phase0/shuffling tests

* phase0/ssz_static tests

* spectest/utils

* fix build

* readme

* update test sizes

* update readme
This commit is contained in:
Victor Farazdagi
2021-04-22 17:53:30 +03:00
committed by GitHub
parent e52df323f7
commit 23ff14c34b
156 changed files with 1011 additions and 903 deletions

View File

@@ -21,6 +21,7 @@ go_library(
"//beacon-chain:__subpackages__",
"//fuzz:__pkg__",
"//shared/testutil:__pkg__",
"//spectest:__subpackages__",
"//validator/accounts:__pkg__",
],
deps = [

View File

@@ -1,91 +0,0 @@
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 = ["block_processing_test.yaml.go"],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks/spectest",
visibility = ["//beacon-chain:__subpackages__"],
)
test_suite(
name = "go_default_test",
tags = ["spectest"],
tests = [
":go_mainnet_test",
# Minimal tests must be run with --define ssz=minimal
#":go_minimal_test",
],
)
go_test(
name = "go_mainnet_test",
size = "medium",
srcs = glob(
["*_test.go"],
exclude = ["*_minimal_test.go"],
),
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
embed = [":go_default_library"],
shard_count = 4,
tags = ["spectest"],
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/core/state/stateutils:go_default_library",
"//beacon-chain/core/validators:go_default_library",
"//beacon-chain/state/interface:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
# Requires --define ssz=minimal
go_test(
name = "go_minimal_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_mainnet_test.go"],
),
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_minimal//:test_data",
],
embed = [":go_default_library"],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/core/state/stateutils:go_default_library",
"//beacon-chain/core/validators:go_default_library",
"//beacon-chain/state/interface:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestAttestationMainnet(t *testing.T) {
runAttestationTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestAttestationMinimal(t *testing.T) {
runAttestationTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestAttesterSlashingMainnet(t *testing.T) {
runAttesterSlashingTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestAttesterSlashingMinimal(t *testing.T) {
runAttesterSlashingTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestBlockHeaderMainnet(t *testing.T) {
runBlockHeaderTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestBlockHeaderMinimal(t *testing.T) {
runBlockHeaderTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestBlockProcessingMainnet(t *testing.T) {
runBlockProcessingTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestBlockProcessingMinimal(t *testing.T) {
runBlockProcessingTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestDepositMainnet(t *testing.T) {
runDepositTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestDepositMinimal(t *testing.T) {
runDepositTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestProposerSlashingMainnet(t *testing.T) {
runProposerSlashingTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestProposerSlashingMinimal(t *testing.T) {
runProposerSlashingTest(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestVoluntaryExitMainnet(t *testing.T) {
runVoluntaryExitTest(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestVoluntaryExitMinimal(t *testing.T) {
runVoluntaryExitTest(t, "minimal")
}

View File

@@ -5,7 +5,10 @@ go_library(
name = "go_default_library",
srcs = ["epoch_processing.go"],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch",
visibility = ["//beacon-chain:__subpackages__"],
visibility = [
"//beacon-chain:__subpackages__",
"//spectest:__subpackages__",
],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/validators:go_default_library",

View File

@@ -12,7 +12,10 @@ go_library(
"type.go",
],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute",
visibility = ["//beacon-chain:__subpackages__"],
visibility = [
"//beacon-chain:__subpackages__",
"//spectest:__subpackages__",
],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/interface:go_default_library",

View File

@@ -1,78 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@prysm//tools/go:def.bzl", "go_library")
test_suite(
name = "go_default_test",
tags = ["spectest"],
tests = [
":go_mainnet_test",
# Minimal tests must be run with --define ssz=minimal
#":go_minimal_test",
],
)
go_test(
name = "go_mainnet_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_minimal_test.go"],
),
data = [
"@eth2_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = [
"spectest",
],
deps = [
"//beacon-chain/core/epoch:go_default_library",
"//beacon-chain/core/epoch/precompute:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
# Requires --define ssz=minimal
go_test(
name = "go_minimal_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_mainnet_test.go"],
),
data = [
"@eth2_spec_tests_minimal//:test_data",
],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//beacon-chain/core/epoch:go_default_library",
"//beacon-chain/core/epoch/precompute:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestRewardsPenaltiesMainnet(t *testing.T) {
runPrecomputeRewardsAndPenaltiesTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestRewardsPenaltiesMinimal(t *testing.T) {
runPrecomputeRewardsAndPenaltiesTests(t, "minimal")
}

View File

@@ -1,75 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
test_suite(
name = "go_default_test",
tags = ["spectest"],
tests = [
":go_mainnet_test",
# Minimal tests must be run with --define ssz=minimal
#":go_minimal_test",
],
)
go_test(
name = "go_mainnet_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_minimal_test.go"],
),
data = [
"@eth2_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = [
"spectest",
],
deps = [
"//beacon-chain/core/epoch:go_default_library",
"//beacon-chain/core/epoch/precompute:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/interface:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
# Requires --define ssz=minimal
go_test(
name = "go_minimal_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_mainnet_test.go"],
),
data = [
"@eth2_spec_tests_minimal//:test_data",
],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//beacon-chain/core/epoch:go_default_library",
"//beacon-chain/core/epoch/precompute:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/interface:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestEffectiveBalanceUpdatesMainnet(t *testing.T) {
runEffectiveBalanceUpdatesTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestEffectiveBalanceUpdatesMinimal(t *testing.T) {
runEffectiveBalanceUpdatesTests(t, "minimal")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestEth1DataResetMainnet(t *testing.T) {
runEth1DataResetTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestEth1DataResetMinimal(t *testing.T) {
runEth1DataResetTests(t, "minimal")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestHistoricalRootsUpdateMainnet(t *testing.T) {
runHistoricalRootsUpdateTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestHistoricalRootsUpdateMinimal(t *testing.T) {
runHistoricalRootsUpdateTests(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestJustificationAndFinalizationMainnet(t *testing.T) {
runJustificationAndFinalizationTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestJustificationAndFinalizationMinimal(t *testing.T) {
runJustificationAndFinalizationTests(t, "minimal")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestParticipationRecordUpdatesMainnet(t *testing.T) {
runParticipationRecordUpdatesTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestParticipationRecordUpdatesMinimal(t *testing.T) {
runParticipationRecordUpdatesTests(t, "minimal")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestRandaoMixesResetMainnet(t *testing.T) {
runRandaoMixesResetTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestRandaoMixesResetMinimal(t *testing.T) {
runRandaoMixesResetTests(t, "minimal")
}

View File

@@ -1,11 +0,0 @@
// Package spectest contains all conformity specification tests
// for epoch processing according to the eth2 spec.
package spectest
import (
"testing"
)
func TestRegistryUpdatesMainnet(t *testing.T) {
runRegistryUpdatesTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestRegistryUpdatesMinimal(t *testing.T) {
runRegistryUpdatesTests(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestRewardsAndPenaltiesMainnet(t *testing.T) {
runRewardsAndPenaltiesTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestRewardsAndPenaltiesMinimal(t *testing.T) {
runRewardsAndPenaltiesTests(t, "minimal")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestSlashingsMainnet(t *testing.T) {
runSlashingsTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestSlashingsMinimal(t *testing.T) {
runSlashingsTests(t, "minimal")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestSlashingsResetMainnet(t *testing.T) {
runSlashingsResetTests(t, "mainnet")
}

View File

@@ -1,7 +0,0 @@
package spectest
import "testing"
func TestSlashingsResetMinimal(t *testing.T) {
runSlashingsResetTests(t, "minimal")
}

View File

@@ -28,6 +28,7 @@ go_library(
"//shared/p2putils:__pkg__",
"//shared/testutil:__pkg__",
"//slasher:__subpackages__",
"//spectest:__subpackages__",
"//tools:__subpackages__",
"//validator:__subpackages__",
],

View File

@@ -1,31 +0,0 @@
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 = ["shuffle_test_format.go"],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers/spectest",
visibility = ["//beacon-chain:__subpackages__"],
deps = ["@com_github_prysmaticlabs_eth2_types//:go_default_library"],
)
go_test(
name = "go_default_test",
size = "medium",
srcs = ["shuffle_yaml_test.go"],
data = [
"@eth2_spec_tests_mainnet//:test_data",
"@eth2_spec_tests_minimal//:test_data",
],
embed = [":go_default_library"],
tags = ["spectest"],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_go_yaml_yaml//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],
)

View File

@@ -20,6 +20,7 @@ go_library(
"//fuzz:__pkg__",
"//shared/interop:__pkg__",
"//shared/testutil:__pkg__",
"//spectest:__subpackages__",
"//tools/benchmark-files-gen:__pkg__",
"//tools/genesis-state-gen:__pkg__",
"//tools/pcli:__pkg__",

View File

@@ -1,77 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
test_suite(
name = "go_default_test",
tags = ["spectest"],
tests = [
":go_mainnet_test",
# Minimal tests must be run with --define ssz=minimal
#":go_minimal_test",
],
)
go_test(
name = "go_mainnet_test",
size = "medium",
srcs = glob(
["*_test.go"],
exclude = ["*_minimal_test.go"],
),
data = [
"@eth2_spec_tests_mainnet//:test_data",
],
shard_count = 2,
tags = ["spectest"],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@com_github_urfave_cli_v2//:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
# Requires --define ssz=minimal
go_test(
name = "go_minimal_test",
size = "small",
srcs = glob(
["*_test.go"],
exclude = ["*_mainnet_test.go"],
),
data = [
"@eth2_spec_tests_minimal//:test_data",
],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/state/stateV0:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@com_github_urfave_cli_v2//:go_default_library",
"@in_gopkg_d4l3k_messagediff_v1//:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

View File

@@ -1,11 +0,0 @@
// Package spectest contains all conformity specification tests
// for slot processing logic according to the eth2 beacon spec.
package spectest
import (
"testing"
)
func TestSlotProcessingMainnet(t *testing.T) {
runSlotProcessingTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package spectest
import (
"testing"
)
func TestSlotProcessingMinimal(t *testing.T) {
runSlotProcessingTests(t, "minimal")
}

View File

@@ -5,7 +5,10 @@ go_library(
name = "go_default_library",
srcs = ["validator.go"],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/validators",
visibility = ["//beacon-chain:__subpackages__"],
visibility = [
"//beacon-chain:__subpackages__",
"//spectest:__subpackages__",
],
deps = [
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/state/interface:go_default_library",

View File

@@ -13,6 +13,7 @@ go_library(
"//shared/depositutil:__subpackages__",
"//shared/testutil:__pkg__",
"//slasher/rpc:__subpackages__",
"//spectest:__subpackages__",
"//tools/benchmark-files-gen:__pkg__",
"//tools/pcli:__pkg__",
],

View File

@@ -40,6 +40,7 @@ go_library(
"//shared/interop:__subpackages__",
"//shared/testutil:__pkg__",
"//slasher/rpc:__subpackages__",
"//spectest:__subpackages__",
"//tools/benchmark-files-gen:__pkg__",
"//tools/pcli:__pkg__",
],

View File

@@ -35,7 +35,6 @@ go_test(
name = "go_default_test",
size = "small",
srcs = [
"ssz_static_test.go",
"tags_test.go",
],
data = [
@@ -51,71 +50,6 @@ go_test(
"//proto/beacon/p2p/v1:go_default_library",
"//proto/validator/accounts/v2:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_ferranbt_fastssz//:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
# Requires --define ssz=minimal
go_test(
name = "go_minimal_test",
size = "small",
srcs = [
"ssz_static_minimal_test.go",
"ssz_static_test.go",
],
data = [
"@eth2_spec_tests_minimal//:test_data",
],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//beacon-chain/state/stateV0:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//proto/validator/accounts/v2:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"@com_github_golang_snappy//:go_default_library",
"@com_github_ferranbt_fastssz//:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
go_test(
name = "go_mainnet_test",
size = "small",
srcs = [
"ssz_static_mainnet_test.go",
"ssz_static_test.go",
],
data = [
"@eth2_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = [
"//beacon-chain/state/stateV0:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//proto/validator/accounts/v2:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/params:go_default_library",
"//shared/params/spectest:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",

View File

@@ -1,9 +0,0 @@
package testing
import (
"testing"
)
func TestSZZStatic_Mainnet(t *testing.T) {
runSSZStaticTests(t, "mainnet")
}

View File

@@ -1,9 +0,0 @@
package testing
import (
"testing"
)
func TestSSZStatic_Minimal(t *testing.T) {
runSSZStaticTests(t, "minimal")
}

View File

@@ -8,5 +8,8 @@ go_library(
"interface.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/bls/common",
visibility = ["//shared/bls:__subpackages__"],
visibility = [
"//shared/bls:__subpackages__",
"//spectest:__subpackages__",
],
)

16
spectest/README.md Normal file
View File

@@ -0,0 +1,16 @@
# Spec Tests
Spec testing vectors: https://github.com/ethereum/eth2.0-spec-tests
To run all `mainnet` spec tests:
```bash
bazel test //... --test_tag_filters=spectest
```
Minimal tests require `--define ssz=minimal` setting and are not triggered
automatically when `//...` is selected. One can run minimal tests manually, though:
```bash
bazel query 'tests(attr("tags", "minimal, spectest", //...))' | xargs bazel test --define ssz=minimal
```

View File

@@ -1,5 +1,5 @@
load("@prysm//tools/go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
@@ -7,11 +7,12 @@ go_library(
srcs = [
"aggregate_test.yaml.go",
"aggregate_verify_test.yaml.go",
"doc.go",
"fast_aggregate_verify_test.yaml.go",
"sign_test.yaml.go",
"verify_test.yaml.go",
],
importpath = "github.com/prysmaticlabs/prysm/shared/bls/spectest",
importpath = "github.com/prysmaticlabs/prysm/spectest/general/phase0/bls",
visibility = ["//visibility:public"],
)

View File

@@ -1,4 +1,4 @@
package spectest
package bls
import (
"encoding/hex"
@@ -13,11 +13,11 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestAggregateYaml(t *testing.T) {
t.Run("blst", testAggregateYaml)
func TestAggregate(t *testing.T) {
t.Run("blst", testAggregate)
}
func testAggregateYaml(t *testing.T) {
func testAggregate(t *testing.T) {
testFolders, testFolderPath := testutil.TestFolders(t, "general", "phase0", "bls/aggregate/small")
for _, folder := range testFolders {

View File

@@ -1,7 +1,7 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: aggregate.yaml
package spectest
package bls
type AggregateTest struct {
Input []string `json:"input"`

View File

@@ -1,4 +1,4 @@
package spectest
package bls
import (
"encoding/hex"
@@ -14,11 +14,11 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestAggregateVerifyYaml(t *testing.T) {
t.Run("blst", testAggregateVerifyYaml)
func TestAggregateVerify(t *testing.T) {
t.Run("blst", testAggregateVerify)
}
func testAggregateVerifyYaml(t *testing.T) {
func testAggregateVerify(t *testing.T) {
testFolders, testFolderPath := testutil.TestFolders(t, "general", "phase0", "bls/aggregate_verify/small")
for i, folder := range testFolders {

View File

@@ -1,7 +1,7 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: aggregate_verify.yaml
package spectest
package bls
type AggregateVerifyTest struct {
Input struct {

View File

@@ -0,0 +1,3 @@
// Package bls includes tests to ensure conformity with the eth2 BLS cryptography specification.
// See https://github.com/ethereum/eth2.0-spec-tests/tree/master/tests/general/phase0/bls for details.
package bls

View File

@@ -1,4 +1,4 @@
package spectest
package bls
import (
"encoding/hex"
@@ -14,11 +14,11 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestFastAggregateVerifyYaml(t *testing.T) {
t.Run("blst", testFastAggregateVerifyYaml)
func TestFastAggregateVerify(t *testing.T) {
t.Run("blst", testFastAggregateVerify)
}
func testFastAggregateVerifyYaml(t *testing.T) {
func testFastAggregateVerify(t *testing.T) {
testFolders, testFolderPath := testutil.TestFolders(t, "general", "phase0", "bls/fast_aggregate_verify/small")
for i, folder := range testFolders {

View File

@@ -1,7 +1,7 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: fast_aggregate_verify.yaml
package spectest
package bls
type FastAggregateVerifyTest struct {
Input struct {

View File

@@ -1,6 +1,4 @@
// Package spectest includes tests to ensure conformity with the eth2
// bls cryptography specification.
package spectest
package bls
import (
"bytes"
@@ -16,11 +14,11 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestSignMessageYaml(t *testing.T) {
t.Run("blst", testSignMessageYaml)
func TestSign(t *testing.T) {
t.Run("blst", testSign)
}
func testSignMessageYaml(t *testing.T) {
func testSign(t *testing.T) {
testFolders, testFolderPath := testutil.TestFolders(t, "general", "phase0", "bls/sign/small")
for i, folder := range testFolders {

View File

@@ -1,7 +1,7 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: sign_msg.yaml
package spectest
package bls
type SignMsgTest struct {
Input struct {

View File

@@ -1,4 +1,4 @@
package spectest
package bls
import (
"encoding/hex"
@@ -13,11 +13,11 @@ import (
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestVerifyMessageYaml(t *testing.T) {
t.Run("blst", testVerifyMessageYaml)
func TestVerify(t *testing.T) {
t.Run("blst", testVerify)
}
func testVerifyMessageYaml(t *testing.T) {
func testVerify(t *testing.T) {
testFolders, testFolderPath := testutil.TestFolders(t, "general", "phase0", "bls/verify/small")
for i, folder := range testFolders {

View File

@@ -1,7 +1,7 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: verify.yaml
package spectest
package bls
type VerifyMsgTest struct {
Input struct {

View File

@@ -0,0 +1,28 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = [
"effective_balance_updates_test.go",
"epoch_processing_test.go",
"eth1_data_reset_test.go",
"historical_roots_update_test.go",
"justification_and_finalization_test.go",
"participation_record_updates_test.go",
"randao_mixes_reset_test.go",
"registry_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = [
"//shared/params:go_default_library",
"//spectest/shared/phase0/epoch_processing:go_default_library",
],
)

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_EffectiveBalanceUpdates(t *testing.T) {
epoch_processing.RunEffectiveBalanceUpdatesTests(t, "mainnet")
}

View File

@@ -1,4 +1,4 @@
package spectest
package epoch_processing
import (
"testing"

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_Eth1DataReset(t *testing.T) {
epoch_processing.RunEth1DataResetTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_HistoricalRootsUpdate(t *testing.T) {
epoch_processing.RunHistoricalRootsUpdateTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_JustificationAndFinalization(t *testing.T) {
epoch_processing.RunJustificationAndFinalizationTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_ParticipationRecordUpdates(t *testing.T) {
epoch_processing.RunParticipationRecordUpdatesTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_RandaoMixesReset(t *testing.T) {
epoch_processing.RunRandaoMixesResetTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_ResetRegistryUpdates(t *testing.T) {
epoch_processing.RunRegistryUpdatesTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_RewardsAndPenalties(t *testing.T) {
epoch_processing.RunRewardsAndPenaltiesTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_SlashingsReset(t *testing.T) {
epoch_processing.RunSlashingsResetTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_Slashings(t *testing.T) {
epoch_processing.RunSlashingsTests(t, "mainnet")
}

View File

@@ -0,0 +1,20 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = [
"attestation_test.go",
"attester_slashing_test.go",
"block_header_test.go",
"deposit_test.go",
"proposer_slashing_test.go",
"voluntary_exit_test.go",
],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//spectest/shared/phase0/operations:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_Attestation(t *testing.T) {
operations.RunAttestationTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_AttesterSlashing(t *testing.T) {
operations.RunAttesterSlashingTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_BlockHeader(t *testing.T) {
operations.RunBlockHeaderTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_Deposit(t *testing.T) {
operations.RunDepositTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_ProposerSlashing(t *testing.T) {
operations.RunProposerSlashingTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package operations
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/operations"
)
func TestMainnet_Phase0_Operations_VoluntaryExit(t *testing.T) {
operations.RunVoluntaryExitTest(t, "mainnet")
}

View File

@@ -0,0 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["rewards_test.go"],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//spectest/shared/phase0/rewards:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package rewards
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/rewards"
)
func TestMainnet_Phase0_Rewards(t *testing.T) {
rewards.RunPrecomputeRewardsAndPenaltiesTests(t, "mainnet")
}

View File

@@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = [
"blocks_test.go",
"slots_test.go",
],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//spectest/shared/phase0/sanity:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package sanity
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/sanity"
)
func TestMainnet_Phase0_Sanity_Blocks(t *testing.T) {
sanity.RunBlockProcessingTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package sanity
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/sanity"
)
func TestMainnet_Phase0_Sanity_Slots(t *testing.T) {
sanity.RunSlotProcessingTests(t, "mainnet")
}

View File

@@ -0,0 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["shuffle_test.go"],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//spectest/shared/phase0/shuffling/core/shuffle:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package shuffle
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/shuffling/core/shuffle"
)
func TestMainnet_Phase0_Shuffling_Core_Shuffle(t *testing.T) {
shuffle.RunShuffleTests(t, "mainnet")
}

View File

@@ -0,0 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["ssz_static_test.go"],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//spectest/shared/phase0/ssz_static:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package ssz_static
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/ssz_static"
)
func TestMainnet_Phase0_SSZStatic(t *testing.T) {
ssz_static.RunSSZStaticTests(t, "mainnet")
}

View File

@@ -0,0 +1,32 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
# Requires --define ssz=minimal
go_test(
name = "go_default_test",
size = "small",
srcs = [
"effective_balance_updates_test.go",
"epoch_processing_test.go",
"eth1_data_reset_test.go",
"historical_roots_update_test.go",
"justification_and_finalization_test.go",
"participation_record_updates_test.go",
"randao_mixes_reset_test.go",
"registry_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@eth2_spec_tests_minimal//:test_data",
],
tags = [
"manual",
"minimal",
"spectest",
],
deps = [
"//shared/params:go_default_library",
"//spectest/shared/phase0/epoch_processing:go_default_library",
],
)

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMinimal_Phase0_EpochProcessing_EffectiveBalanceUpdates(t *testing.T) {
epoch_processing.RunEffectiveBalanceUpdatesTests(t, "minimal")
}

View File

@@ -0,0 +1,17 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/shared/params"
)
func TestMain(m *testing.M) {
prevConfig := params.BeaconConfig().Copy()
defer params.OverrideBeaconConfig(prevConfig)
c := params.BeaconConfig()
c.MinGenesisActiveValidatorCount = 16384
params.OverrideBeaconConfig(c)
m.Run()
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/spectest/shared/phase0/epoch_processing"
)
func TestMinimal_Phase0_EpochProcessing_Eth1DataReset(t *testing.T) {
epoch_processing.RunEth1DataResetTests(t, "minimal")
}

Some files were not shown because too many files have changed in this diff Show More