diff --git a/testing/endtoend/BUILD.bazel b/testing/endtoend/BUILD.bazel index 5581b86fe4..0b2c932a35 100644 --- a/testing/endtoend/BUILD.bazel +++ b/testing/endtoend/BUILD.bazel @@ -52,7 +52,6 @@ go_test( "endtoend_setup_test.go", "endtoend_test.go", "minimal_e2e_test.go", - "minimal_slashing_e2e_test.go", "slasher_simulator_e2e_test.go", ], args = ["-test.v"], diff --git a/testing/endtoend/minimal_scenario_e2e_test.go b/testing/endtoend/minimal_scenario_e2e_test.go index a799a174f0..f87822abf0 100644 --- a/testing/endtoend/minimal_scenario_e2e_test.go +++ b/testing/endtoend/minimal_scenario_e2e_test.go @@ -3,6 +3,7 @@ package endtoend import ( "testing" + ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators" "github.com/prysmaticlabs/prysm/testing/endtoend/types" ) @@ -18,6 +19,20 @@ func TestEndToEnd_MinimalConfig_Web3Signer(t *testing.T) { e2eMinimal(t, types.WithRemoteSigner()).run() } +func TestEndToEnd_MinimalConfig_Slasher(t *testing.T) { + e2eMinimal( + t, + types.WithSlasher( + ev.PeersConnect, + ev.HealthzCheck, + ev.ValidatorsSlashedAfterEpoch(4), + ev.SlashedValidatorsLoseBalanceAfterEpoch(4), + ev.InjectDoubleVoteOnEpoch(2), + ev.InjectDoubleBlockOnEpoch(2), + ), + ).run() +} + func TestEndToEnd_ScenarioRun_EEOffline(t *testing.T) { t.Skip("TODO(#10242) Prysm is current unable to handle an offline e2e") runner := e2eMinimal(t) diff --git a/testing/endtoend/minimal_slashing_e2e_test.go b/testing/endtoend/minimal_slashing_e2e_test.go deleted file mode 100644 index 97c9b04837..0000000000 --- a/testing/endtoend/minimal_slashing_e2e_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package endtoend - -import ( - "fmt" - "testing" - - "github.com/prysmaticlabs/prysm/config/params" - ev "github.com/prysmaticlabs/prysm/testing/endtoend/evaluators" - e2eParams "github.com/prysmaticlabs/prysm/testing/endtoend/params" - "github.com/prysmaticlabs/prysm/testing/endtoend/types" - "github.com/prysmaticlabs/prysm/testing/require" -) - -func TestEndToEnd_Slasher_MinimalConfig(t *testing.T) { - params.SetupTestConfigCleanup(t) - params.OverrideBeaconConfig(params.E2ETestConfig().Copy()) - require.NoError(t, e2eParams.Init(t, e2eParams.StandardBeaconCount)) - - tracingPort := e2eParams.TestParams.Ports.JaegerTracingPort - tracingEndpoint := fmt.Sprintf("127.0.0.1:%d", tracingPort) - - testConfig := &types.E2EConfig{ - BeaconFlags: []string{ - "--slasher", - }, - ValidatorFlags: []string{}, - EpochsToRun: 4, - TestSync: false, - TestFeature: false, - TestDeposits: false, - Evaluators: []types.Evaluator{ - ev.PeersConnect, - ev.HealthzCheck, - ev.ValidatorsSlashedAfterEpoch(4), - ev.SlashedValidatorsLoseBalanceAfterEpoch(4), - ev.InjectDoubleVoteOnEpoch(2), - ev.InjectDoubleBlockOnEpoch(2), - }, - EvalInterceptor: defaultInterceptor, - TracingSinkEndpoint: tracingEndpoint, - } - - newTestRunner(t, testConfig).run() -} diff --git a/testing/endtoend/types/types.go b/testing/endtoend/types/types.go index 46ca843904..9ebaa4c06b 100644 --- a/testing/endtoend/types/types.go +++ b/testing/endtoend/types/types.go @@ -23,6 +23,14 @@ func WithRemoteSigner() E2EConfigOpt { } } +func WithSlasher(evs ...Evaluator) E2EConfigOpt { + return func(cfg *E2EConfig) { + cfg.UseSlasher = true + cfg.Evaluators = evs + cfg.BeaconFlags = append(cfg.BeaconFlags, "--slasher") + } +} + func WithCheckpointSync() E2EConfigOpt { return func(cfg *E2EConfig) { cfg.TestCheckpointSync = true @@ -37,6 +45,7 @@ type E2EConfig struct { UsePrysmShValidator bool UsePprof bool UseWeb3RemoteSigner bool + UseSlasher bool TestDeposits bool UseFixedPeerIDs bool UseValidatorCrossClient bool