diff --git a/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py index d7a36669d..1c5caff81 100644 --- a/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py +++ b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py @@ -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 diff --git a/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_basic.py b/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_basic.py index a16384882..6c212afbc 100644 --- a/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_basic.py +++ b/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_basic.py @@ -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): diff --git a/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_random.py b/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_random.py index 2ddfd68dd..530261df6 100644 --- a/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_random.py +++ b/tests/core/pyspec/eth2spec/test/altair/fork/test_altair_fork_random.py @@ -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)) diff --git a/tests/core/pyspec/eth2spec/test/altair/rewards/test_inactivity_scores.py b/tests/core/pyspec/eth2spec/test/altair/rewards/test_inactivity_scores.py index 9eca9a92a..b6b362a8b 100644 --- a/tests/core/pyspec/eth2spec/test/altair/rewards/test_inactivity_scores.py +++ b/tests/core/pyspec/eth2spec/test/altair/rewards/test_inactivity_scores.py @@ -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): diff --git a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attestation.py b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attestation.py index 0f5eef407..38a050ebc 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attestation.py +++ b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attestation.py @@ -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) diff --git a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attester_slashing.py b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attester_slashing.py index 7345e62ba..4a2c7d61d 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attester_slashing.py +++ b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_attester_slashing.py @@ -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): diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_effective_balance_updates.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_effective_balance_updates.py index dc4c047a2..43fe12220 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_effective_balance_updates.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_effective_balance_updates.py @@ -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 diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_registry_updates.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_registry_updates.py index ee40984a6..6e7784aa9 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_registry_updates.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_registry_updates.py @@ -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) 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 b7ae3cf4e..e336ebef7 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 @@ -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) diff --git a/tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py b/tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py index b1af64a77..1184a6617 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py +++ b/tests/core/pyspec/eth2spec/test/phase0/rewards/test_random.py @@ -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): diff --git a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py index 117ce1947..0e22e75b8 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py @@ -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