Move Spectests Into a Testing/ Folder (#9582)

This commit is contained in:
Raul Jordan
2021-09-14 11:02:58 -05:00
committed by GitHub
parent ac3c544e29
commit 6340e58f36
229 changed files with 237 additions and 237 deletions

View File

@@ -0,0 +1,16 @@
# Spec Tests
Spec testing vectors: https://github.com/ethereum/consensus-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

@@ -0,0 +1,42 @@
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
testonly = True,
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/testing/spectest/general/phase0/bls",
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
size = "small",
srcs = [
"aggregate_test.go",
"aggregate_verify_test.go",
"fast_aggregate_verify_test.go",
"sign_test.go",
"verify_test.go",
],
data = [
"@consensus_spec_tests_general//:test_data",
],
embed = [":go_default_library"],
tags = ["spectest"],
deps = [
"//shared/bls:go_default_library",
"//shared/bls/common:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/spectest/utils:go_default_library",
"@com_github_ghodss_yaml//:go_default_library",
],
)

View File

@@ -0,0 +1,56 @@
package bls
import (
"encoding/hex"
"path"
"strings"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
)
func TestAggregate(t *testing.T) {
t.Run("blst", testAggregate)
}
func testAggregate(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate/small")
for _, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml"))
require.NoError(t, err)
test := &AggregateTest{}
require.NoError(t, yaml.Unmarshal(file, test))
var sigs []common.Signature
for _, s := range test.Input {
sigBytes, err := hex.DecodeString(s[2:])
require.NoError(t, err)
sig, err := bls.SignatureFromBytes(sigBytes)
require.NoError(t, err)
sigs = append(sigs, sig)
}
if len(test.Input) == 0 {
if test.Output != "" {
t.Fatalf("Output Aggregate is not of zero length:Output %s", test.Output)
}
return
}
sig := bls.AggregateSignatures(sigs)
if strings.Contains(folder.Name(), "aggregate_na_pubkeys") {
if sig != nil {
t.Errorf("Expected nil signature, received: %v", sig)
}
return
}
outputBytes, err := hex.DecodeString(test.Output[2:])
require.NoError(t, err)
require.DeepEqual(t, outputBytes, sig.Marshal())
})
}
}

View File

@@ -0,0 +1,9 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: aggregate.yaml
package bls
type AggregateTest struct {
Input []string `json:"input"`
Output string `json:"output" ssz:"size=96"`
}

View File

@@ -0,0 +1,68 @@
package bls
import (
"encoding/hex"
"errors"
"path"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
)
func TestAggregateVerify(t *testing.T) {
t.Run("blst", testAggregateVerify)
}
func testAggregateVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate_verify/small")
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml"))
require.NoError(t, err)
test := &AggregateVerifyTest{}
require.NoError(t, yaml.Unmarshal(file, test))
pubkeys := make([]common.PublicKey, 0, len(test.Input.Pubkeys))
msgs := make([][32]byte, 0, len(test.Input.Messages))
for _, pubKey := range test.Input.Pubkeys {
pkBytes, err := hex.DecodeString(pubKey[2:])
require.NoError(t, err)
pk, err := bls.PublicKeyFromBytes(pkBytes)
if err != nil {
if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) {
return
}
t.Fatalf("cannot unmarshal pubkey: %v", err)
}
pubkeys = append(pubkeys, pk)
}
for _, msg := range test.Input.Messages {
msgBytes, err := hex.DecodeString(msg[2:])
require.NoError(t, err)
require.Equal(t, 32, len(msgBytes))
msgs = append(msgs, bytesutil.ToBytes32(msgBytes))
}
sigBytes, err := hex.DecodeString(test.Input.Signature[2:])
require.NoError(t, err)
sig, err := bls.SignatureFromBytes(sigBytes)
if err != nil {
if test.Output == false {
return
}
t.Fatalf("Cannot unmarshal input to signature: %v", err)
}
verified := sig.AggregateVerify(pubkeys, msgs)
if verified != test.Output {
t.Fatalf("Signature does not match the expected verification output. "+
"Expected %#v but received %#v for test case %d", test.Output, verified, i)
}
})
}
}

View File

@@ -0,0 +1,13 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: aggregate_verify.yaml
package bls
type AggregateVerifyTest struct {
Input struct {
Pubkeys []string `json:"pubkeys"`
Messages []string `json:"messages"`
Signature string `json:"signature"`
} `json:"input"`
Output bool `json:"output"`
}

View File

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

View File

@@ -0,0 +1,71 @@
package bls
import (
"encoding/hex"
"errors"
"path"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
)
func TestFastAggregateVerify(t *testing.T) {
t.Run("blst", testFastAggregateVerify)
}
func testFastAggregateVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/fast_aggregate_verify/small")
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml"))
require.NoError(t, err)
test := &FastAggregateVerifyTest{}
require.NoError(t, yaml.Unmarshal(file, test))
pubkeys := make([]common.PublicKey, len(test.Input.Pubkeys))
for j, raw := range test.Input.Pubkeys {
pkBytes, err := hex.DecodeString(raw[2:])
require.NoError(t, err)
pk, err := bls.PublicKeyFromBytes(pkBytes)
if err != nil {
if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) {
return
}
t.Fatalf("cannot unmarshal pubkey: %v", err)
}
pubkeys[j] = pk
}
msg := test.Input.Message
// TODO(#7632): Remove when https://github.com/ethereum/consensus-spec-tests/issues/22 is resolved.
if msg == "" {
msg = test.Input.Messages
}
msgBytes, err := hex.DecodeString(msg[2:])
require.NoError(t, err)
sigBytes, err := hex.DecodeString(test.Input.Signature[2:])
require.NoError(t, err)
sig, err := bls.SignatureFromBytes(sigBytes)
if err != nil {
if test.Output == false {
return
}
t.Fatalf("Cannot unmarshal input to signature: %v", err)
}
verified := sig.FastAggregateVerify(pubkeys, bytesutil.ToBytes32(msgBytes))
if verified != test.Output {
t.Fatalf("Signature does not match the expected verification output. "+
"Expected %#v but received %#v for test case %d", test.Output, verified, i)
}
t.Log("Success")
})
}
}

View File

@@ -0,0 +1,15 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: fast_aggregate_verify.yaml
package bls
type FastAggregateVerifyTest struct {
Input struct {
Pubkeys []string `json:"pubkeys"`
Message string `json:"message"`
// TODO(#7632): Remove when https://github.com/ethereum/consensus-spec-tests/issues/22 is resolved.
Messages string `json:"messages"`
Signature string `json:"signature"`
} `json:"input"`
Output bool `json:"output"`
}

View File

@@ -0,0 +1,59 @@
package bls
import (
"bytes"
"encoding/hex"
"errors"
"path"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
)
func TestSign(t *testing.T) {
t.Run("blst", testSign)
}
func testSign(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/sign/small")
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml"))
require.NoError(t, err)
test := &SignMsgTest{}
require.NoError(t, yaml.Unmarshal(file, test))
pkBytes, err := hex.DecodeString(test.Input.Privkey[2:])
require.NoError(t, err)
sk, err := bls.SecretKeyFromBytes(pkBytes)
if err != nil {
if test.Output == "" &&
(errors.Is(err, common.ErrZeroKey) || errors.Is(err, common.ErrSecretUnmarshal)) {
return
}
t.Fatalf("cannot unmarshal secret key: %v", err)
}
msgBytes, err := hex.DecodeString(test.Input.Message[2:])
require.NoError(t, err)
sig := sk.Sign(msgBytes)
if !sig.Verify(sk.PublicKey(), msgBytes) {
t.Fatal("could not verify signature")
}
outputBytes, err := hex.DecodeString(test.Output[2:])
require.NoError(t, err)
if !bytes.Equal(outputBytes, sig.Marshal()) {
t.Fatalf("Test Case %d: Signature does not match the expected output. "+
"Expected %#x but received %#x", i, outputBytes, sig.Marshal())
}
t.Log("Success")
})
}
}

View File

@@ -0,0 +1,12 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: sign_msg.yaml
package bls
type SignMsgTest struct {
Input struct {
Privkey string `json:"privkey"`
Message string `json:"message"`
} `json:"input"`
Output string `json:"output"`
}

View File

@@ -0,0 +1,61 @@
package bls
import (
"encoding/hex"
"errors"
"path"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bls/common"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
)
func TestVerify(t *testing.T) {
t.Run("blst", testVerify)
}
func testVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/verify/small")
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
file, err := testutil.BazelFileBytes(path.Join(testFolderPath, folder.Name(), "data.yaml"))
require.NoError(t, err)
test := &VerifyMsgTest{}
require.NoError(t, yaml.Unmarshal(file, test))
pkBytes, err := hex.DecodeString(test.Input.Pubkey[2:])
require.NoError(t, err)
pk, err := bls.PublicKeyFromBytes(pkBytes)
if err != nil {
if test.Output == false && errors.Is(err, common.ErrInfinitePubKey) {
return
}
t.Fatalf("cannot unmarshal pubkey: %v", err)
}
msgBytes, err := hex.DecodeString(test.Input.Message[2:])
require.NoError(t, err)
sigBytes, err := hex.DecodeString(test.Input.Signature[2:])
require.NoError(t, err)
sig, err := bls.SignatureFromBytes(sigBytes)
if err != nil {
if test.Output == false {
return
}
t.Fatalf("Cannot unmarshal input to signature: %v", err)
}
verified := sig.Verify(pk, msgBytes)
if verified != test.Output {
t.Fatalf("Signature does not match the expected verification output. "+
"Expected %#v but received %#v for test case %d", test.Output, verified, i)
}
t.Log("Success")
})
}
}

View File

@@ -0,0 +1,13 @@
// Code generated by yaml_to_go. DO NOT EDIT.
// source: verify.yaml
package bls
type VerifyMsgTest struct {
Input struct {
Pubkey string `json:"pubkey"`
Message string `json:"message"`
Signature string `json:"signature"`
} `json:"input"`
Output bool `json:"output"`
}

View File

@@ -0,0 +1,25 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = [
"effective_balance_updates_test.go",
"eth1_data_reset_test.go",
"historical_roots_update_test.go",
"inactivity_updates_test.go",
"justification_and_finalization_test.go",
"participation_flag_updates_test.go",
"randao_mixes_reset_test.go",
"registry_updates_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/epoch_processing:go_default_library"],
)

View File

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

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_EpochProcessing_InactivityUpdates(t *testing.T) {
epoch_processing.RunInactivityUpdatesTest(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_EpochProcessing_ParticipationFlag(t *testing.T) {
epoch_processing.RunParticipationFlagUpdatesTests(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
package epoch_processing
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_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/testing/spectest/shared/altair/epoch_processing"
)
func TestMainnet_Altair_EpochProcessing_Slashings(t *testing.T) {
epoch_processing.RunSlashingsTests(t, "mainnet")
}

View File

@@ -0,0 +1,13 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
srcs = ["finality_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/finality:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package finality
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/finality"
)
func TestMainnet_Altair_Finality(t *testing.T) {
finality.RunFinalityTest(t, "mainnet")
}

View File

@@ -0,0 +1,13 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["upgrade_to_altair_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/fork:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package fork_helper
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/fork"
)
func TestMainnet_Altair_UpgradeToAltair(t *testing.T) {
fork.RunUpgradeToAltair(t, "mainnet")
}

View File

@@ -0,0 +1,11 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
srcs = ["transition_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/fork:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package fork_transition
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/fork"
)
func TestMainnet_Altair_Transition(t *testing.T) {
fork.RunForkTransitionTest(t, "mainnet")
}

View File

@@ -0,0 +1,21 @@
load("@prysm//tools/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",
"sync_committee_test.go",
"voluntary_exit_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/operations:go_default_library"],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,12 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
srcs = ["random_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/sanity:go_default_library"],
)

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,15 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
srcs = [
"blocks_test.go",
"slots_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/altair/sanity:go_default_library"],
)

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,28 @@
load("@prysm//tools/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_updates_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = [
"//shared/params:go_default_library",
"//testing/spectest/shared/phase0/epoch_processing:go_default_library",
],
)

View File

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

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/testing/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/testing/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/testing/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/testing/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/testing/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/testing/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/testing/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/testing/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/testing/spectest/shared/phase0/epoch_processing"
)
func TestMainnet_Phase0_EpochProcessing_Slashings(t *testing.T) {
epoch_processing.RunSlashingsTests(t, "mainnet")
}

View File

@@ -0,0 +1,13 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
srcs = ["finality_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/phase0/finality:go_default_library"],
)

View File

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

View File

@@ -0,0 +1,20 @@
load("@prysm//tools/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"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/phase0/operations:go_default_library"],
)

View File

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

View File

@@ -0,0 +1,12 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
srcs = ["random_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/phase0/sanity:go_default_library"],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "medium",
timeout = "short",
srcs = ["shuffle_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/phase0/shuffling/core/shuffle:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package shuffle
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/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("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["ssz_static_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/phase0/ssz_static:go_default_library"],
)

View File

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

View File

@@ -0,0 +1,28 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = [
"effective_balance_updates_test.go",
"eth1_data_reset_test.go",
"historical_roots_update_test.go",
"inactivity_updates_test.go",
"justification_and_finalization_test.go",
"participation_flag_updates_test.go",
"randao_mixes_reset_test.go",
"registry_updates_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_minimal//:test_data",
],
eth_network = "minimal",
tags = [
"minimal",
"spectest",
],
deps = ["//testing/spectest/shared/altair/epoch_processing:go_default_library"],
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,17 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["finality_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_minimal//:test_data",
],
eth_network = "minimal",
shard_count = 4,
tags = [
"minimal",
"spectest",
],
deps = ["//testing/spectest/shared/altair/finality:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package finality
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/finality"
)
func TestMinimal_Altair_Finality(t *testing.T) {
finality.RunFinalityTest(t, "minimal")
}

View File

@@ -0,0 +1,17 @@
load("@prysm//tools/go:def.bzl", "go_test")
go_test(
name = "go_default_test",
size = "small",
srcs = ["upgrade_to_altair_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_minimal//:test_data",
],
eth_network = "minimal",
shard_count = 4,
tags = [
"minimal",
"spectest",
],
deps = ["//testing/spectest/shared/altair/fork:go_default_library"],
)

View File

@@ -0,0 +1,11 @@
package fork
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/spectest/shared/altair/fork"
)
func TestMinimal_Altair_UpgradeToAltair(t *testing.T) {
fork.RunUpgradeToAltair(t, "minimal")
}

View File

@@ -0,0 +1,24 @@
load("@prysm//tools/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",
"sync_committee_test.go",
"voluntary_exit_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_minimal//:test_data",
],
eth_network = "minimal",
tags = [
"minimal",
"spectest",
],
deps = ["//testing/spectest/shared/altair/operations:go_default_library"],
)

View File

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

View File

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

View File

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

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