diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py index 65f9a134e..3e96f8b58 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py @@ -26,7 +26,12 @@ def slash_validators(spec, state, indices, out_epochs): @with_all_phases @spec_state_test def test_max_penalties(spec, state): - slashed_count = (len(state.validators) // spec.PROPORTIONAL_SLASHING_MULTIPLIER) + 1 + # Slashed count to ensure that enough validators are slashed to induce maximum penalties + slashed_count = min( + (len(state.validators) // spec.PROPORTIONAL_SLASHING_MULTIPLIER) + 1, + # Can't slash more than validator count! + len(state.validators) + ) out_epoch = spec.get_current_epoch(state) + (spec.EPOCHS_PER_SLASHINGS_VECTOR // 2) slashed_indices = list(range(slashed_count))