2022-05-20 09:34:10 +00:00
|
|
|
package endtoend
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strconv"
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/config/params"
|
|
|
|
ev "github.com/prysmaticlabs/prysm/v5/testing/endtoend/evaluators"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/endtoend/evaluators/beaconapi"
|
|
|
|
e2eParams "github.com/prysmaticlabs/prysm/v5/testing/endtoend/params"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/endtoend/types"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
2022-05-20 09:34:10 +00:00
|
|
|
)
|
|
|
|
|
2023-11-08 12:24:23 +00:00
|
|
|
func e2eMinimal(t *testing.T, cfg *params.BeaconChainConfig, cfgo ...types.E2EConfigOpt) *testRunner {
|
2022-05-20 09:34:10 +00:00
|
|
|
params.SetupTestConfigCleanup(t)
|
2023-11-08 12:24:23 +00:00
|
|
|
require.NoError(t, params.SetActive(cfg))
|
2022-05-25 15:57:13 +00:00
|
|
|
require.NoError(t, e2eParams.Init(t, e2eParams.StandardBeaconCount))
|
2022-05-20 09:34:10 +00:00
|
|
|
|
2023-08-16 23:30:05 +00:00
|
|
|
// Run for 12 epochs if not in long-running to confirm long-running has no issues.
|
2022-05-20 09:34:10 +00:00
|
|
|
var err error
|
2023-11-08 12:24:23 +00:00
|
|
|
epochsToRun := 14
|
2022-05-20 09:34:10 +00:00
|
|
|
epochStr, longRunning := os.LookupEnv("E2E_EPOCHS")
|
|
|
|
if longRunning {
|
|
|
|
epochsToRun, err = strconv.Atoi(epochStr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
seed := 0
|
|
|
|
seedStr, isValid := os.LookupEnv("E2E_SEED")
|
|
|
|
if isValid {
|
|
|
|
seed, err = strconv.Atoi(seedStr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
tracingPort := e2eParams.TestParams.Ports.JaegerTracingPort
|
|
|
|
tracingEndpoint := fmt.Sprintf("127.0.0.1:%d", tracingPort)
|
|
|
|
evals := []types.Evaluator{
|
|
|
|
ev.PeersConnect,
|
|
|
|
ev.HealthzCheck,
|
|
|
|
ev.MetricsCheck,
|
|
|
|
ev.ValidatorsAreActive,
|
|
|
|
ev.ValidatorsParticipatingAtEpoch(2),
|
|
|
|
ev.FinalizationOccurs(3),
|
|
|
|
ev.VerifyBlockGraffiti,
|
|
|
|
ev.PeersCheck,
|
|
|
|
ev.ProposeVoluntaryExit,
|
2022-11-19 03:40:32 +00:00
|
|
|
ev.ValidatorsHaveExited,
|
2023-02-10 06:19:15 +00:00
|
|
|
ev.SubmitWithdrawal,
|
|
|
|
ev.ValidatorsHaveWithdrawn,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.ProcessesDepositsInBlocks,
|
|
|
|
ev.ActivatesDepositedValidators,
|
|
|
|
ev.DepositedValidatorsAreActive,
|
|
|
|
ev.ValidatorsVoteWithTheMajority,
|
|
|
|
ev.ColdStateCheckpoint,
|
|
|
|
ev.AltairForkTransition,
|
|
|
|
ev.BellatrixForkTransition,
|
2023-02-10 06:19:15 +00:00
|
|
|
ev.CapellaForkTransition,
|
2023-11-08 12:24:23 +00:00
|
|
|
ev.DenebForkTransition,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
|
|
|
ev.FinishedSyncing,
|
|
|
|
ev.AllNodesHaveSameHead,
|
|
|
|
ev.ValidatorSyncParticipation,
|
2022-07-14 20:04:03 +00:00
|
|
|
ev.FeeRecipientIsPresent,
|
2022-08-03 18:47:30 +00:00
|
|
|
//ev.TransactionsPresent, TODO: Re-enable Transaction evaluator once it tx pool issues are fixed.
|
2022-05-20 09:34:10 +00:00
|
|
|
}
|
|
|
|
testConfig := &types.E2EConfig{
|
|
|
|
BeaconFlags: []string{
|
|
|
|
fmt.Sprintf("--slots-per-archive-point=%d", params.BeaconConfig().SlotsPerEpoch*16),
|
|
|
|
fmt.Sprintf("--tracing-endpoint=http://%s", tracingEndpoint),
|
|
|
|
"--enable-tracing",
|
|
|
|
"--trace-sample-fraction=1.0",
|
|
|
|
},
|
|
|
|
ValidatorFlags: []string{},
|
|
|
|
EpochsToRun: uint64(epochsToRun),
|
|
|
|
TestSync: true,
|
|
|
|
TestFeature: true,
|
|
|
|
TestDeposits: true,
|
|
|
|
UsePrysmShValidator: false,
|
2024-01-05 05:23:22 +00:00
|
|
|
UsePprof: true,
|
2022-05-20 09:34:10 +00:00
|
|
|
TracingSinkEndpoint: tracingEndpoint,
|
|
|
|
Evaluators: evals,
|
|
|
|
EvalInterceptor: defaultInterceptor,
|
|
|
|
Seed: int64(seed),
|
2022-05-25 22:52:43 +00:00
|
|
|
}
|
|
|
|
for _, o := range cfgo {
|
|
|
|
o(testConfig)
|
2022-05-20 09:34:10 +00:00
|
|
|
}
|
2023-05-11 16:10:29 +00:00
|
|
|
if testConfig.UseBuilder {
|
|
|
|
testConfig.Evaluators = append(testConfig.Evaluators, ev.BuilderIsActive)
|
|
|
|
}
|
2022-05-20 09:34:10 +00:00
|
|
|
|
|
|
|
return newTestRunner(t, testConfig)
|
|
|
|
}
|
|
|
|
|
2022-12-21 04:43:29 +00:00
|
|
|
func e2eMainnet(t *testing.T, usePrysmSh, useMultiClient bool, cfg *params.BeaconChainConfig, cfgo ...types.E2EConfigOpt) *testRunner {
|
2022-05-20 09:34:10 +00:00
|
|
|
params.SetupTestConfigCleanup(t)
|
2022-12-21 04:43:29 +00:00
|
|
|
require.NoError(t, params.SetActive(cfg))
|
2022-05-20 09:34:10 +00:00
|
|
|
if useMultiClient {
|
2022-05-25 15:57:13 +00:00
|
|
|
require.NoError(t, e2eParams.InitMultiClient(t, e2eParams.StandardBeaconCount, e2eParams.StandardLighthouseNodeCount))
|
2022-05-20 09:34:10 +00:00
|
|
|
} else {
|
2022-05-25 15:57:13 +00:00
|
|
|
require.NoError(t, e2eParams.Init(t, e2eParams.StandardBeaconCount))
|
2022-05-20 09:34:10 +00:00
|
|
|
}
|
|
|
|
// Run for 10 epochs if not in long-running to confirm long-running has no issues.
|
|
|
|
var err error
|
2023-11-08 12:24:23 +00:00
|
|
|
epochsToRun := 14
|
2022-05-20 09:34:10 +00:00
|
|
|
epochStr, longRunning := os.LookupEnv("E2E_EPOCHS")
|
|
|
|
if longRunning {
|
|
|
|
epochsToRun, err = strconv.Atoi(epochStr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
seed := 0
|
|
|
|
seedStr, isValid := os.LookupEnv("E2E_SEED")
|
|
|
|
if isValid {
|
|
|
|
seed, err = strconv.Atoi(seedStr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
tracingPort := e2eParams.TestParams.Ports.JaegerTracingPort
|
|
|
|
tracingEndpoint := fmt.Sprintf("127.0.0.1:%d", tracingPort)
|
|
|
|
evals := []types.Evaluator{
|
|
|
|
ev.PeersConnect,
|
|
|
|
ev.HealthzCheck,
|
|
|
|
ev.MetricsCheck,
|
|
|
|
ev.ValidatorsParticipatingAtEpoch(2),
|
|
|
|
ev.FinalizationOccurs(3),
|
|
|
|
ev.ProposeVoluntaryExit,
|
2022-11-19 03:40:32 +00:00
|
|
|
ev.ValidatorsHaveExited,
|
2023-02-14 19:05:54 +00:00
|
|
|
ev.SubmitWithdrawal,
|
|
|
|
ev.ValidatorsHaveWithdrawn,
|
2022-12-06 16:01:17 +00:00
|
|
|
ev.DepositedValidatorsAreActive,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.ColdStateCheckpoint,
|
|
|
|
ev.AltairForkTransition,
|
|
|
|
ev.BellatrixForkTransition,
|
2023-02-10 06:19:15 +00:00
|
|
|
ev.CapellaForkTransition,
|
2023-11-08 12:24:23 +00:00
|
|
|
ev.DenebForkTransition,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
|
|
|
ev.FinishedSyncing,
|
|
|
|
ev.AllNodesHaveSameHead,
|
2022-07-20 16:08:13 +00:00
|
|
|
ev.FeeRecipientIsPresent,
|
2022-08-03 18:47:30 +00:00
|
|
|
//ev.TransactionsPresent, TODO: Re-enable Transaction evaluator once it tx pool issues are fixed.
|
2022-05-20 09:34:10 +00:00
|
|
|
}
|
|
|
|
testConfig := &types.E2EConfig{
|
|
|
|
BeaconFlags: []string{
|
|
|
|
fmt.Sprintf("--slots-per-archive-point=%d", params.BeaconConfig().SlotsPerEpoch*16),
|
|
|
|
fmt.Sprintf("--tracing-endpoint=http://%s", tracingEndpoint),
|
|
|
|
"--enable-tracing",
|
|
|
|
"--trace-sample-fraction=1.0",
|
|
|
|
},
|
2022-12-08 04:20:35 +00:00
|
|
|
ValidatorFlags: []string{},
|
|
|
|
EpochsToRun: uint64(epochsToRun),
|
|
|
|
TestSync: true,
|
|
|
|
TestFeature: true,
|
|
|
|
TestDeposits: true,
|
|
|
|
UseFixedPeerIDs: true,
|
|
|
|
UsePrysmShValidator: usePrysmSh,
|
2024-01-05 05:23:22 +00:00
|
|
|
UsePprof: true,
|
2022-12-08 04:20:35 +00:00
|
|
|
TracingSinkEndpoint: tracingEndpoint,
|
|
|
|
Evaluators: evals,
|
|
|
|
EvalInterceptor: defaultInterceptor,
|
|
|
|
Seed: int64(seed),
|
2022-06-15 08:02:31 +00:00
|
|
|
}
|
|
|
|
for _, o := range cfgo {
|
|
|
|
o(testConfig)
|
2022-06-30 00:24:39 +00:00
|
|
|
}
|
2022-12-21 04:43:29 +00:00
|
|
|
|
2022-12-08 04:20:35 +00:00
|
|
|
// In the event we use the cross-client e2e option, we add in an additional
|
|
|
|
// evaluator for multiclient runs to verify the beacon api conformance.
|
|
|
|
if testConfig.UseValidatorCrossClient {
|
2023-11-30 16:53:51 +00:00
|
|
|
testConfig.Evaluators = append(testConfig.Evaluators, beaconapi.MultiClientVerifyIntegrity)
|
2022-12-08 04:20:35 +00:00
|
|
|
}
|
2023-05-11 16:10:29 +00:00
|
|
|
if testConfig.UseBuilder {
|
|
|
|
testConfig.Evaluators = append(testConfig.Evaluators, ev.BuilderIsActive)
|
|
|
|
}
|
2022-05-20 09:34:10 +00:00
|
|
|
return newTestRunner(t, testConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
func scenarioEvals() []types.Evaluator {
|
|
|
|
return []types.Evaluator{
|
|
|
|
ev.PeersConnect,
|
|
|
|
ev.HealthzCheck,
|
|
|
|
ev.MetricsCheck,
|
|
|
|
ev.ValidatorsParticipatingAtEpoch(2),
|
|
|
|
ev.FinalizationOccurs(3),
|
|
|
|
ev.VerifyBlockGraffiti,
|
|
|
|
ev.ProposeVoluntaryExit,
|
2022-11-19 03:40:32 +00:00
|
|
|
ev.ValidatorsHaveExited,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.ColdStateCheckpoint,
|
|
|
|
ev.AltairForkTransition,
|
|
|
|
ev.BellatrixForkTransition,
|
2023-02-10 06:19:15 +00:00
|
|
|
ev.CapellaForkTransition,
|
2023-11-08 12:24:23 +00:00
|
|
|
ev.DenebForkTransition,
|
2022-05-20 09:34:10 +00:00
|
|
|
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
|
|
|
ev.FinishedSyncing,
|
|
|
|
ev.AllNodesHaveSameHead,
|
|
|
|
ev.ValidatorSyncParticipation,
|
|
|
|
}
|
|
|
|
}
|
2022-05-25 03:10:51 +00:00
|
|
|
|
|
|
|
func scenarioEvalsMulti() []types.Evaluator {
|
|
|
|
return []types.Evaluator{
|
|
|
|
ev.PeersConnect,
|
|
|
|
ev.HealthzCheck,
|
|
|
|
ev.MetricsCheck,
|
|
|
|
ev.ValidatorsParticipatingAtEpoch(2),
|
|
|
|
ev.FinalizationOccurs(3),
|
|
|
|
ev.ProposeVoluntaryExit,
|
2022-11-19 03:40:32 +00:00
|
|
|
ev.ValidatorsHaveExited,
|
2022-05-25 03:10:51 +00:00
|
|
|
ev.ColdStateCheckpoint,
|
|
|
|
ev.AltairForkTransition,
|
|
|
|
ev.BellatrixForkTransition,
|
2023-02-10 06:19:15 +00:00
|
|
|
ev.CapellaForkTransition,
|
2023-11-08 12:24:23 +00:00
|
|
|
ev.DenebForkTransition,
|
2022-05-25 03:10:51 +00:00
|
|
|
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
|
|
|
ev.FinishedSyncing,
|
|
|
|
ev.AllNodesHaveSameHead,
|
|
|
|
}
|
|
|
|
}
|