extend validator set so randomized helpers have more room for operation

This commit is contained in:
Alex Stokes 2021-08-22 09:58:54 -07:00
parent 513f57f74c
commit 820affd2aa
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69
2 changed files with 12 additions and 4 deletions

View File

@ -152,12 +152,13 @@ def misc_balances(spec):
return balances
def misc_balances_in_default_range(spec):
def misc_balances_in_default_range_with_many_validators(spec):
"""
Helper method to create a series of balances that includes some misc. balances but
none that are below the ``EJECTION_BALANCE``.
"""
num_validators = spec.SLOTS_PER_EPOCH * 8
# Double validators to facilitate randomized testing
num_validators = spec.SLOTS_PER_EPOCH * 8 * 2
floor = spec.config.EJECTION_BALANCE + spec.EFFECTIVE_BALANCE_INCREMENT
balances = [
max(spec.MAX_EFFECTIVE_BALANCE * 2 * i // num_validators, floor) for i in range(num_validators)

View File

@ -3,7 +3,11 @@ import warnings
from random import Random
from tests.core.pyspec.eth2spec.test.helpers.constants import PHASE0, ALTAIR
from typing import Callable
from tests.core.pyspec.eth2spec.test.context import misc_balances_in_default_range, with_phases, zero_activation_threshold
from tests.core.pyspec.eth2spec.test.context import (
misc_balances_in_default_range_with_many_validators,
with_phases,
zero_activation_threshold,
)
from eth2spec.test.helpers.multi_operations import (
build_random_block_from_state,
)
@ -323,7 +327,10 @@ def _iter_temporal(spec, callable_or_int):
@pytest_generate_tests_adapter
@with_phases([PHASE0, ALTAIR])
@with_custom_state(balances_fn=misc_balances_in_default_range, threshold_fn=zero_activation_threshold)
@with_custom_state(
balances_fn=misc_balances_in_default_range_with_many_validators,
threshold_fn=zero_activation_threshold
)
@spec_test
@single_phase
@always_bls