update ejection balance config references

This commit is contained in:
protolambda
2021-05-19 17:43:56 +02:00
parent ff021da551
commit 46bb8273df
11 changed files with 26 additions and 26 deletions

View File

@@ -70,7 +70,7 @@ def test_sync_committees_progress_not_genesis(spec, state):
@with_altair_and_later
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
@always_bls

View File

@@ -57,7 +57,7 @@ def test_fork_many_next_epoch(spec, phases, state):
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_fork_random_low_balances(spec, phases, state):
@@ -65,7 +65,7 @@ def test_fork_random_low_balances(spec, phases, state):
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_fork_random_misc_balances(spec, phases, state):
@@ -75,7 +75,7 @@ def test_fork_random_misc_balances(spec, phases, state):
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
@with_presets([MINIMAL],
reason="mainnet config leads to larger validator set than limit of public/private keys pre-generated")
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_fork_random_large_validator_set(spec, phases, state):

View File

@@ -93,7 +93,7 @@ def test_altair_fork_random_mismatched_attestations(spec, phases, state):
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
@spec_test
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_altair_fork_random_low_balances(spec, phases, state):
randomize_state(spec, state, rng=Random(5050))
@@ -102,7 +102,7 @@ def test_altair_fork_random_low_balances(spec, phases, state):
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
@spec_test
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_altair_fork_random_misc_balances(spec, phases, state):
randomize_state(spec, state, rng=Random(6060))
@@ -113,7 +113,7 @@ def test_altair_fork_random_misc_balances(spec, phases, state):
@with_presets([MINIMAL],
reason="mainnet config leads to larger validator set than limit of public/private keys pre-generated")
@spec_test
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS)
def test_altair_fork_random_large_validator_set(spec, phases, state):
randomize_state(spec, state, rng=Random(7070))

View File

@@ -45,7 +45,7 @@ def test_random_high_inactivity_scores(spec, state):
@with_altair_and_later
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_random_inactivity_scores_low_balances_0(spec, state):
@@ -54,7 +54,7 @@ def test_random_inactivity_scores_low_balances_0(spec, state):
@with_altair_and_later
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_random_inactivity_scores_low_balances_1(spec, state):
@@ -63,7 +63,7 @@ def test_random_inactivity_scores_low_balances_1(spec, state):
@with_altair_and_later
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_full_random_misc_balances(spec, state):

View File

@@ -32,7 +32,7 @@ def test_success(spec, state):
@with_all_phases
@spec_test
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@single_phase
def test_success_multi_proposer_index_iterations(spec, state):
next_slots(spec, state, spec.SLOTS_PER_EPOCH * 2)

View File

@@ -127,7 +127,7 @@ def test_success_already_exited_recent(spec, state):
@with_all_phases
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_success_low_balances(spec, state):
@@ -137,7 +137,7 @@ def test_success_low_balances(spec, state):
@with_all_phases
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_success_misc_balances(spec, state):
@@ -147,7 +147,7 @@ def test_success_misc_balances(spec, state):
@with_all_phases
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_success_with_effective_balance_disparity(spec, state):

View File

@@ -10,7 +10,7 @@ def test_effective_balance_hysteresis(spec, state):
run_epoch_processing_to(spec, state, 'process_effective_balance_updates')
# Set some edge cases for balances
max = spec.MAX_EFFECTIVE_BALANCE
min = spec.EJECTION_BALANCE
min = spec.config.EJECTION_BALANCE
inc = spec.EFFECTIVE_BALANCE_INCREMENT
div = spec.HYSTERESIS_QUOTIENT
hys_inc = inc // div

View File

@@ -153,7 +153,7 @@ def test_ejection(spec, state):
assert state.validators[index].exit_epoch == spec.FAR_FUTURE_EPOCH
# Mock an ejection
state.validators[index].effective_balance = spec.EJECTION_BALANCE
state.validators[index].effective_balance = spec.config.EJECTION_BALANCE
yield from run_process_registry_updates(spec, state)
@@ -174,7 +174,7 @@ def test_ejection_past_churn_limit(spec, state):
mock_ejections = churn_limit * 3
for i in range(mock_ejections):
state.validators[i].effective_balance = spec.EJECTION_BALANCE
state.validators[i].effective_balance = spec.config.EJECTION_BALANCE
expected_ejection_epoch = spec.compute_activation_exit_epoch(spec.get_current_epoch(state))
@@ -211,7 +211,7 @@ def test_activation_queue_activation_and_ejection(spec, state):
# ready for ejection
ejection_index = 2
state.validators[ejection_index].effective_balance = spec.EJECTION_BALANCE
state.validators[ejection_index].effective_balance = spec.config.EJECTION_BALANCE
yield from run_process_registry_updates(spec, state)

View File

@@ -82,7 +82,7 @@ def test_minimal_penalty(spec, state):
#
# Just the bare minimum for this one validator
state.balances[0] = state.validators[0].effective_balance = spec.EJECTION_BALANCE
state.balances[0] = state.validators[0].effective_balance = spec.config.EJECTION_BALANCE
# All the other validators get the maximum.
for i in range(1, len(state.validators)):
state.validators[i].effective_balance = state.balances[i] = spec.MAX_EFFECTIVE_BALANCE
@@ -120,7 +120,7 @@ def test_scaled_penalties(spec, state):
next_epoch(spec, state)
# Also mock some previous slashings, so that we test to have the delta in the penalties computation.
base = spec.EJECTION_BALANCE
base = spec.config.EJECTION_BALANCE
incr = spec.EFFECTIVE_BALANCE_INCREMENT
# Just add some random slashings. non-zero slashings are at least the minimal effective balance.
state.slashings[0] = base + (incr * 12)

View File

@@ -36,7 +36,7 @@ def test_full_random_3(spec, state):
@with_all_phases
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_full_random_low_balances_0(spec, state):
@@ -44,7 +44,7 @@ def test_full_random_low_balances_0(spec, state):
@with_all_phases
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_full_random_low_balances_1(spec, state):
@@ -52,7 +52,7 @@ def test_full_random_low_balances_1(spec, state):
@with_all_phases
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@spec_test
@single_phase
def test_full_random_misc_balances(spec, state):

View File

@@ -101,7 +101,7 @@ def test_empty_block_transition(spec, state):
@with_presets([MINIMAL],
reason="mainnet config leads to larger validator set than limit of public/private keys pre-generated")
@spec_test
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@single_phase
def test_empty_block_transition_large_validator_set(spec, state):
pre_slot = state.slot
@@ -329,7 +329,7 @@ def test_empty_epoch_transition(spec, state):
@with_presets([MINIMAL],
reason="mainnet config leads to larger validator set than limit of public/private keys pre-generated")
@spec_test
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.config.EJECTION_BALANCE)
@single_phase
def test_empty_epoch_transition_large_validator_set(spec, state):
pre_slot = state.slot
@@ -916,7 +916,7 @@ def test_balance_driven_status_transitions(spec, state):
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
# set validator balance to below ejection threshold
state.validators[validator_index].effective_balance = spec.EJECTION_BALANCE
state.validators[validator_index].effective_balance = spec.config.EJECTION_BALANCE
yield 'pre', state