prysm-pulse/testing/endtoend/endtoend_setup_test.go

218 lines
6.6 KiB
Go
Raw Normal View History

package endtoend
import (
"fmt"
"os"
"strconv"
"testing"
"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"
)
func e2eMinimal(t *testing.T, cfg *params.BeaconChainConfig, cfgo ...types.E2EConfigOpt) *testRunner {
params.SetupTestConfigCleanup(t)
require.NoError(t, params.SetActive(cfg))
require.NoError(t, e2eParams.Init(t, e2eParams.StandardBeaconCount))
// Run for 12 epochs if not in long-running to confirm long-running has no issues.
var err error
epochsToRun := 14
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,
ev.ValidatorsHaveExited,
ev.SubmitWithdrawal,
ev.ValidatorsHaveWithdrawn,
ev.ProcessesDepositsInBlocks,
ev.ActivatesDepositedValidators,
ev.DepositedValidatorsAreActive,
ev.ValidatorsVoteWithTheMajority,
ev.ColdStateCheckpoint,
ev.AltairForkTransition,
ev.BellatrixForkTransition,
ev.CapellaForkTransition,
ev.DenebForkTransition,
ev.APIGatewayV1Alpha1VerifyIntegrity,
ev.FinishedSyncing,
ev.AllNodesHaveSameHead,
ev.ValidatorSyncParticipation,
ev.FeeRecipientIsPresent,
//ev.TransactionsPresent, TODO: Re-enable Transaction evaluator once it tx pool issues are fixed.
}
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,
TracingSinkEndpoint: tracingEndpoint,
Evaluators: evals,
EvalInterceptor: defaultInterceptor,
Seed: int64(seed),
}
for _, o := range cfgo {
o(testConfig)
}
if testConfig.UseBuilder {
testConfig.Evaluators = append(testConfig.Evaluators, ev.BuilderIsActive)
}
return newTestRunner(t, testConfig)
}
func e2eMainnet(t *testing.T, usePrysmSh, useMultiClient bool, cfg *params.BeaconChainConfig, cfgo ...types.E2EConfigOpt) *testRunner {
params.SetupTestConfigCleanup(t)
require.NoError(t, params.SetActive(cfg))
if useMultiClient {
require.NoError(t, e2eParams.InitMultiClient(t, e2eParams.StandardBeaconCount, e2eParams.StandardLighthouseNodeCount))
} else {
require.NoError(t, e2eParams.Init(t, e2eParams.StandardBeaconCount))
}
// Run for 10 epochs if not in long-running to confirm long-running has no issues.
var err error
epochsToRun := 14
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,
ev.ValidatorsHaveExited,
ev.SubmitWithdrawal,
ev.ValidatorsHaveWithdrawn,
E2E: beacon APIs Part 1 (#11306) * adding compare beacon block test * fixing bazel * fixing evaluator import * fixing imports * changing package name * fixing bazel * adding logic to check for checking epoch * fixing linting * adding check for attester duties * handle both blockv1 and blockv2 * making middleware objects public instead * adding test for block attestations * fixing typo * adding blockroot test * adding test for attestations * fixing type value * fixing test * adding in node endpoints * fixing bazel * updating web3signer * printing beacon blocks on request * fixing struct * temp log * forgot string cast * adding comparison function * fixing bazel and evaulators, WIP * fixing bazel * changing how to minify json * trying multiclient * fixing port problem * reverting evaluator and making test only for mainnet scenario testing * removing test data * fixing linting unused functions git push * changed to reflect * adding in ssz comparison * fixing tests * fixing conflict * fixing tests * making v2 the standard * adding better error logging * fixing type * adding lighthouse settings and fixing some deepsource items * testing adding delay to evaluator * testing without peers check * changing target peers to try to fix lighthouse peer connections * temp removing other tests * fix lint issue * adding peers connect back in * adding in state version * fixing bazel * fixing path error * testing changes to state * fix unmarshal * simplifying beacon api e2e execution * fixing missed assertian checks * improve logging and debugging issue * trying to fix unmarshal * still breaking more test edits * removing fork to test unmarshal * fixing pathing * resolving error * fixing beacon_api * merging in debug api to beacon_api test * fixing lint and temp commenting out endpoint * adding in custom comparison function * fixing custom evaluator * adding test for block header data * fixing header evaluation * add node apis * fixing linting,adding tests * fixing bazel and temp removing unused functions * fixing deepsource and linting issues * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing review * resolving more review comments * fixing linting * removing ssz return value as it's large and possibly not needed * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * fixing more review comments * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * fixing linting and review iteems * fixing cognit complexity issue * fixing linting * fix log printout * test build kite only with crossclient * switching out evaluator to depositedvalidatorsareactive * removed wrong evaluator switching correct one * removing skip based on review comments * fixing pathing issue * test without participation at epoch * testing without special lighthouse logic in evaluator * reducing expected participation when multiclient * fixing imports * reducing epochs to see if less flaky * testing with other tests added back in * reducing epochs ran further * testing only cross client again * testing multi run again * test reverted scenario for tests * testing with cross client * removing commented out function * testing without peers connect * adding optimization based on suggestions * removed the wrong peers connect * accidently commited something I shouldn't have * fixing lighthouse flag * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update testing/endtoend/evaluators/beaconapi_evaluators/beacon_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2022-12-06 16:01:17 +00:00
ev.DepositedValidatorsAreActive,
ev.ColdStateCheckpoint,
ev.AltairForkTransition,
ev.BellatrixForkTransition,
ev.CapellaForkTransition,
ev.DenebForkTransition,
ev.APIGatewayV1Alpha1VerifyIntegrity,
ev.FinishedSyncing,
ev.AllNodesHaveSameHead,
ev.FeeRecipientIsPresent,
//ev.TransactionsPresent, TODO: Re-enable Transaction evaluator once it tx pool issues are fixed.
}
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,
UseFixedPeerIDs: true,
UsePrysmShValidator: usePrysmSh,
2024-01-05 05:23:22 +00:00
UsePprof: true,
TracingSinkEndpoint: tracingEndpoint,
Evaluators: evals,
EvalInterceptor: defaultInterceptor,
Seed: int64(seed),
}
for _, o := range cfgo {
o(testConfig)
E2E: fee-recipient evaluator (#10528) * testing out fee-recipient evaluator * fixing bazel linter * adjusting comparison * typo on file rolling back * adding fee recipient is present to minimal e2e * fixing gofmt * fixing gofmt * fixing flag usage name * adding in log to help debug * fixing log build * trying to figure out why suggested fee recipient isn't working in e2e, adding more logging temporarily * rolling back logs * making e2e test more dynamic * fixing deepsource issue * fixing bazel * adding in condition for latest release * duplicate condtion check. * fixing gofmt * rolling back changes * adding fee recipient evaluator in new file * fixing validator component logic * testing rpc client addition * testing fee recipient evaluator * fixing bazel: * testing casting * test casting * reverting * testing casting * testing casting * testing log * adding bazel fix * switching mixed case and adding temp logging * fixing gofmt * rolling back changes * removing fee recipient evaluator when web3signer is used * test only minimal config * reverting changes * adding fee recipient evaluator to mainnet * current version uses wrong flag name * optimizing key usage * making mining address a variable * moving from global to local variable * removing unneeded log * removing redundant check * make proposer settings mroe deterministic and also have the evaluator compare the wanting values * fixing err return * fixing bazel * checking file too much moving it out * fixing gosec * trying to fix gosec error * trying to fix address * fixing linting * trying to gerenate key and random address * fixing linting * fixing check for proposer config * trying with multi config files * fixing is dir check * testing for older previous balance * adding logging to help debug * changing how i get the block numbers * fixing missed error check * adding gasused check * adding log for current gas used * taking suggestion to make fee recipient more deterministic * fixing linting * fixing check * fixing the address check * fixing format error * logic to differentiate recipients * fixing linting
2022-06-30 00:24:39 +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 {
testConfig.Evaluators = append(testConfig.Evaluators, beaconapi.MultiClientVerifyIntegrity)
}
if testConfig.UseBuilder {
testConfig.Evaluators = append(testConfig.Evaluators, ev.BuilderIsActive)
}
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,
ev.ValidatorsHaveExited,
ev.ColdStateCheckpoint,
ev.AltairForkTransition,
ev.BellatrixForkTransition,
ev.CapellaForkTransition,
ev.DenebForkTransition,
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,
ev.ValidatorsHaveExited,
2022-05-25 03:10:51 +00:00
ev.ColdStateCheckpoint,
ev.AltairForkTransition,
ev.BellatrixForkTransition,
ev.CapellaForkTransition,
ev.DenebForkTransition,
2022-05-25 03:10:51 +00:00
ev.APIGatewayV1Alpha1VerifyIntegrity,
ev.FinishedSyncing,
ev.AllNodesHaveSameHead,
}
}