From bc239e9cc7fac9ff89d89eb8e0f5f036371c850e Mon Sep 17 00:00:00 2001 From: Suphanat Chunhapanya Date: Wed, 25 Sep 2024 19:49:40 +0700 Subject: [PATCH] Rename SHARD_COMMITTEE_PERIOD This commit renames SHARD_COMMITTEE_PERIOD to MIN_VALIDATOR_ACTIVE_PERIOD. Since we don't have shard committees anymore, naming things after shard committees doesn't make sense. This commit renames it to MIN_VALIDATOR_ACTIVE_PERIOD so that it means the minimum period that the validator has to be active before exiting. --- configs/mainnet.yaml | 2 +- configs/minimal.yaml | 2 +- specs/deneb/beacon-chain.md | 2 +- specs/electra/beacon-chain.md | 4 +- specs/phase0/beacon-chain.md | 4 +- .../test_process_sync_aggregate.py | 16 ++--- .../test/altair/transition/test_operations.py | 8 +-- .../test_process_voluntary_exit.py | 4 +- .../test/capella/sanity/test_blocks.py | 4 +- .../test_process_voluntary_exit.py | 20 +++--- .../test_process_withdrawal_request.py | 68 +++++++++---------- .../test/electra/sanity/blocks/test_blocks.py | 16 ++--- .../eth2spec/test/helpers/multi_operations.py | 10 +-- .../test_process_voluntary_exit.py | 30 ++++---- .../test/phase0/sanity/test_blocks.py | 14 ++-- .../test/utils/randomized_block_tests.py | 2 +- 16 files changed, 103 insertions(+), 103 deletions(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index 56c20a439c..5f61262bbc 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -72,7 +72,7 @@ SECONDS_PER_ETH1_BLOCK: 14 # 2**8 (= 256) epochs ~27 hours MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 # 2**8 (= 256) epochs ~27 hours -SHARD_COMMITTEE_PERIOD: 256 +MIN_VALIDATOR_ACTIVE_PERIOD: 256 # 2**11 (= 2,048) Eth1 blocks ~8 hours ETH1_FOLLOW_DISTANCE: 2048 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index a2b4f2e736..61caea624b 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -71,7 +71,7 @@ SECONDS_PER_ETH1_BLOCK: 14 # 2**8 (= 256) epochs MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 # [customized] higher frequency of committee turnover and faster time to acceptable voluntary exit -SHARD_COMMITTEE_PERIOD: 64 +MIN_VALIDATOR_ACTIVE_PERIOD: 64 # [customized] process deposits more quickly, but insecure ETH1_FOLLOW_DISTANCE: 16 diff --git a/specs/deneb/beacon-chain.md b/specs/deneb/beacon-chain.md index 0f6a8fc076..331f21ffd2 100644 --- a/specs/deneb/beacon-chain.md +++ b/specs/deneb/beacon-chain.md @@ -422,7 +422,7 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu # Exits must specify an epoch when they become valid; they are not valid before then assert get_current_epoch(state) >= voluntary_exit.epoch # Verify the validator has been active long enough - assert get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD + assert get_current_epoch(state) >= validator.activation_epoch + MIN_VALIDATOR_ACTIVE_PERIOD # Verify signature # [Modified in Deneb:EIP7044] domain = compute_domain(DOMAIN_VOLUNTARY_EXIT, CAPELLA_FORK_VERSION, state.genesis_validators_root) diff --git a/specs/electra/beacon-chain.md b/specs/electra/beacon-chain.md index dbf84d8de8..dbd729d354 100644 --- a/specs/electra/beacon-chain.md +++ b/specs/electra/beacon-chain.md @@ -1319,7 +1319,7 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu # Exits must specify an epoch when they become valid; they are not valid before then assert get_current_epoch(state) >= voluntary_exit.epoch # Verify the validator has been active long enough - assert get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD + assert get_current_epoch(state) >= validator.activation_epoch + MIN_VALIDATOR_ACTIVE_PERIOD # Only exit validator if it has no pending withdrawals in the queue assert get_pending_balance_to_withdraw(state, voluntary_exit.validator_index) == 0 # [New in Electra:EIP7251] # Verify signature @@ -1368,7 +1368,7 @@ def process_withdrawal_request( if validator.exit_epoch != FAR_FUTURE_EPOCH: return # Verify the validator has been active long enough - if get_current_epoch(state) < validator.activation_epoch + SHARD_COMMITTEE_PERIOD: + if get_current_epoch(state) < validator.activation_epoch + MIN_VALIDATOR_ACTIVE_PERIOD: return pending_balance_to_withdraw = get_pending_balance_to_withdraw(state, index) diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index 9d5f8446a0..f7c961bb6a 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -306,7 +306,7 @@ Testnets and other types of chain instances may use a different configuration. | `SECONDS_PER_SLOT` | `uint64(12)` | seconds | 12 seconds | | `SECONDS_PER_ETH1_BLOCK` | `uint64(14)` | seconds | 14 seconds | | `MIN_VALIDATOR_WITHDRAWABILITY_DELAY` | `uint64(2**8)` (= 256) | epochs | ~27 hours | -| `SHARD_COMMITTEE_PERIOD` | `uint64(2**8)` (= 256) | epochs | ~27 hours | +| `MIN_VALIDATOR_ACTIVE_PERIOD` | `uint64(2**8)` (= 256) | epochs | ~27 hours | | `ETH1_FOLLOW_DISTANCE` | `uint64(2**11)` (= 2,048) | Eth1 blocks | ~8 hours | ### Validator cycle @@ -1931,7 +1931,7 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu # Exits must specify an epoch when they become valid; they are not valid before then assert get_current_epoch(state) >= voluntary_exit.epoch # Verify the validator has been active long enough - assert get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD + assert get_current_epoch(state) >= validator.activation_epoch + MIN_VALIDATOR_ACTIVE_PERIOD # Verify signature domain = get_domain(state, DOMAIN_VOLUNTARY_EXIT, voluntary_exit.epoch) signing_root = compute_signing_root(voluntary_exit, domain) diff --git a/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py index f1a270092c..688157ced8 100644 --- a/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py +++ b/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py @@ -551,8 +551,8 @@ def _exit_validator_from_committee_and_transition_state(spec, @spec_state_test @always_bls def test_sync_committee_with_participating_exited_member(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # move forward via some blocks for _ in range(3): @@ -590,8 +590,8 @@ def test_sync_committee_with_participating_exited_member(spec, state): @spec_state_test @always_bls def test_sync_committee_with_nonparticipating_exited_member(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # move forward via some blocks for _ in range(3): @@ -633,8 +633,8 @@ def test_sync_committee_with_nonparticipating_exited_member(spec, state): @spec_state_test @always_bls def test_sync_committee_with_participating_withdrawable_member(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # move forward via some blocks for _ in range(3): @@ -672,8 +672,8 @@ def test_sync_committee_with_participating_withdrawable_member(spec, state): @spec_state_test @always_bls def test_sync_committee_with_nonparticipating_withdrawable_member(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # move forward via some blocks for _ in range(3): diff --git a/tests/core/pyspec/eth2spec/test/altair/transition/test_operations.py b/tests/core/pyspec/eth2spec/test/altair/transition/test_operations.py index 1210531860..cb5cca82ec 100644 --- a/tests/core/pyspec/eth2spec/test/altair/transition/test_operations.py +++ b/tests/core/pyspec/eth2spec/test/altair/transition/test_operations.py @@ -144,10 +144,10 @@ def test_transition_with_deposit_right_before_fork(state, fork_epoch, spec, post def test_transition_with_voluntary_exit_right_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag): """ Create a voluntary exit right *after* the transition. - fork_epoch=66 because minimal preset `SHARD_COMMITTEE_PERIOD` is 64 epochs. + fork_epoch=66 because minimal preset `MIN_VALIDATOR_ACTIVE_PERIOD` is 64 epochs. """ # Fast forward to the future epoch so that validator can do voluntary exit - state.slot = spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot = spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield from run_transition_with_operation( state, @@ -166,10 +166,10 @@ def test_transition_with_voluntary_exit_right_after_fork(state, fork_epoch, spec def test_transition_with_voluntary_exit_right_before_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag): """ Create a voluntary exit right *before* the transition. - fork_epoch=66 because minimal preset `SHARD_COMMITTEE_PERIOD` is 64 epochs. + fork_epoch=66 because minimal preset `MIN_VALIDATOR_ACTIVE_PERIOD` is 64 epochs. """ # Fast forward to the future epoch so that validator can do voluntary exit - state.slot = spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot = spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield from run_transition_with_operation( state, diff --git a/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_voluntary_exit.py b/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_voluntary_exit.py index ea3b57a97a..057217b3d3 100644 --- a/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_voluntary_exit.py +++ b/tests/core/pyspec/eth2spec/test/bellatrix/block_processing/test_process_voluntary_exit.py @@ -32,8 +32,8 @@ def run_voluntary_exit_processing_test( voluntary_exit_epoch = 0 if is_before_fork_epoch else state.fork.epoch - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] diff --git a/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py index dabc2be18b..17ac8fbb61 100644 --- a/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py @@ -126,8 +126,8 @@ def test_deposit_and_bls_change(spec, state): @with_capella_and_later @spec_state_test def test_exit_and_bls_change(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH index = 0 signed_address_change = get_signed_address_change(spec, state, validator_index=index) diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_voluntary_exit.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_voluntary_exit.py index eb2d86e6f9..ab62d91ac9 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_voluntary_exit.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_voluntary_exit.py @@ -18,7 +18,7 @@ @with_electra_and_later @spec_state_test def test_min_balance_exit(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # This state has 64 validators each with 32 ETH current_epoch = spec.get_current_epoch(state) expected_exit_epoch = spec.compute_activation_exit_epoch(current_epoch) @@ -54,7 +54,7 @@ def test_min_balance_exit(spec, state): @with_electra_and_later @spec_state_test def test_min_balance_exits_up_to_churn(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # This state has 64 validators each with 32 ETH single_validator_balance = spec.MIN_ACTIVATION_BALANCE churn_limit = spec.get_activation_exit_churn_limit(state) @@ -107,7 +107,7 @@ def test_min_balance_exits_up_to_churn(spec, state): @with_electra_and_later @spec_state_test def test_min_balance_exits_above_churn(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # This state has 64 validators each with 32 ETH single_validator_balance = spec.MIN_ACTIVATION_BALANCE expected_exit_epoch = spec.compute_activation_exit_epoch( @@ -163,7 +163,7 @@ def test_min_balance_exits_above_churn(spec, state): "With CHURN_LIMIT_QUOTIENT=32, can't change validator balance without changing churn_limit", ) def test_max_balance_exit(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) churn_limit = spec.get_activation_exit_churn_limit(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -208,7 +208,7 @@ def test_max_balance_exit(spec, state): "With CHURN_LIMIT_QUOTIENT=32, can't change validator balance without changing churn_limit", ) def test_exit_with_balance_equal_to_churn_limit(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) churn_limit = spec.get_activation_exit_churn_limit(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -249,7 +249,7 @@ def test_exit_with_balance_equal_to_churn_limit(spec, state): "With CHURN_LIMIT_QUOTIENT=32, can't change validator balance without changing churn_limit", ) def test_exit_with_balance_multiple_of_churn_limit(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) churn_limit = spec.get_activation_exit_churn_limit(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -292,7 +292,7 @@ def test_exit_with_balance_multiple_of_churn_limit(spec, state): "With CHURN_LIMIT_QUOTIENT=32, can't change validator balance without changing churn_limit", ) def test_exit_existing_churn_and_churn_limit_balance(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) churn_limit = spec.get_activation_exit_churn_limit(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -339,7 +339,7 @@ def test_exit_existing_churn_and_churn_limit_balance(spec, state): "With CHURN_LIMIT_QUOTIENT=32, can't change validator balance without changing churn_limit", ) def test_exit_existing_churn_and_balance_multiple_of_churn_limit(spec, state): - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) churn_limit = spec.get_activation_exit_churn_limit(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -386,8 +386,8 @@ def test_exit_existing_churn_and_balance_multiple_of_churn_limit(spec, state): @with_electra_and_later @spec_state_test def test_invalid_validator_has_pending_withdrawal(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] diff --git a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_withdrawal_request.py b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_withdrawal_request.py index c216b297cb..c1318676a4 100644 --- a/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_withdrawal_request.py +++ b/tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_withdrawal_request.py @@ -21,8 +21,8 @@ @spec_state_test def test_basic_withdrawal_request(spec, state): rng = random.Random(1337) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -45,8 +45,8 @@ def test_basic_withdrawal_request(spec, state): @with_electra_and_later @spec_state_test def test_basic_withdrawal_request_with_first_validator(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -70,8 +70,8 @@ def test_basic_withdrawal_request_with_first_validator(spec, state): @spec_state_test def test_basic_withdrawal_request_with_compounding_credentials(spec, state): rng = random.Random(1338) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -94,7 +94,7 @@ def test_basic_withdrawal_request_with_compounding_credentials(spec, state): @with_presets([MINIMAL], "need full partial withdrawal queue") def test_basic_withdrawal_request_with_full_partial_withdrawal_queue(spec, state): rng = random.Random(1339) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -131,8 +131,8 @@ def test_basic_withdrawal_request_with_full_partial_withdrawal_queue(spec, state @spec_state_test def test_incorrect_source_address(spec, state): rng = random.Random(1340) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -157,8 +157,8 @@ def test_incorrect_source_address(spec, state): @spec_state_test def test_incorrect_withdrawal_credential_prefix(spec, state): rng = random.Random(1341) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -187,8 +187,8 @@ def test_incorrect_withdrawal_credential_prefix(spec, state): @spec_state_test def test_on_withdrawal_request_initiated_validator(spec, state): rng = random.Random(1342) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -229,7 +229,7 @@ def test_activation_epoch_less_than_shard_committee_period(spec, state): assert spec.get_current_epoch(state) < ( state.validators[validator_index].activation_epoch - + spec.config.SHARD_COMMITTEE_PERIOD + + spec.config.MIN_VALIDATOR_ACTIVE_PERIOD ) yield from run_withdrawal_request_processing( @@ -244,7 +244,7 @@ def test_activation_epoch_less_than_shard_committee_period(spec, state): @with_presets([MINIMAL]) def test_basic_partial_withdrawal_request(spec, state): rng = random.Random(1344) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -277,7 +277,7 @@ def test_basic_partial_withdrawal_request(spec, state): @with_presets([MINIMAL]) def test_basic_partial_withdrawal_request_higher_excess_balance(spec, state): rng = random.Random(1345) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -310,7 +310,7 @@ def test_basic_partial_withdrawal_request_higher_excess_balance(spec, state): @with_presets([MINIMAL]) def test_basic_partial_withdrawal_request_lower_than_excess_balance(spec, state): rng = random.Random(1346) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -344,7 +344,7 @@ def test_basic_partial_withdrawal_request_lower_than_excess_balance(spec, state) @with_presets([MINIMAL]) def test_partial_withdrawal_request_with_pending_withdrawals(spec, state): rng = random.Random(1347) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -386,7 +386,7 @@ def test_partial_withdrawal_request_with_pending_withdrawals_and_high_amount( spec, state ): rng = random.Random(1348) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -425,7 +425,7 @@ def test_partial_withdrawal_request_with_pending_withdrawals_and_high_amount( @with_presets([MINIMAL]) def test_partial_withdrawal_request_with_high_balance(spec, state): rng = random.Random(1349) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -463,7 +463,7 @@ def test_partial_withdrawal_request_with_high_balance(spec, state): @with_presets([MINIMAL]) def test_partial_withdrawal_request_with_high_amount(spec, state): rng = random.Random(1350) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -497,7 +497,7 @@ def test_partial_withdrawal_request_with_high_amount(spec, state): @with_presets([MINIMAL]) def test_partial_withdrawal_request_with_low_amount(spec, state): rng = random.Random(1351) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -533,7 +533,7 @@ def test_partial_withdrawal_request_with_low_amount(spec, state): @with_presets([MINIMAL], "need full partial withdrawal queue") def test_partial_withdrawal_queue_full(spec, state): rng = random.Random(1352) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -564,7 +564,7 @@ def test_partial_withdrawal_queue_full(spec, state): @spec_state_test def test_no_compounding_credentials(spec, state): rng = random.Random(1353) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -594,7 +594,7 @@ def test_no_compounding_credentials(spec, state): @spec_state_test def test_no_excess_balance(spec, state): rng = random.Random(1354) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -617,7 +617,7 @@ def test_no_excess_balance(spec, state): @spec_state_test def test_pending_withdrawals_consume_all_excess_balance(spec, state): rng = random.Random(1355) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -648,7 +648,7 @@ def test_pending_withdrawals_consume_all_excess_balance(spec, state): @spec_state_test def test_insufficient_effective_balance(spec, state): rng = random.Random(1356) - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) validator_pubkey = state.validators[validator_index].pubkey @@ -678,8 +678,8 @@ def test_insufficient_effective_balance(spec, state): @spec_state_test def test_partial_withdrawal_incorrect_source_address(spec, state): rng = random.Random(1357) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -705,8 +705,8 @@ def test_partial_withdrawal_incorrect_source_address(spec, state): @spec_state_test def test_partial_withdrawal_incorrect_withdrawal_credential_prefix(spec, state): rng = random.Random(1358) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -735,8 +735,8 @@ def test_partial_withdrawal_incorrect_withdrawal_credential_prefix(spec, state): @spec_state_test def test_partial_withdrawal_on_exit_initiated_validator(spec, state): rng = random.Random(1359) - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = rng.choice(spec.get_active_validator_indices(state, current_epoch)) @@ -779,7 +779,7 @@ def test_partial_withdrawal_activation_epoch_less_than_shard_committee_period( assert spec.get_current_epoch(state) < ( state.validators[validator_index].activation_epoch - + spec.config.SHARD_COMMITTEE_PERIOD + + spec.config.MIN_VALIDATOR_ACTIVE_PERIOD ) yield from run_withdrawal_request_processing( diff --git a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py index 0bb8f32d46..e027a6623b 100644 --- a/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py @@ -25,8 +25,8 @@ @with_electra_and_later @spec_state_test def test_basic_el_withdrawal_request(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield 'pre', state @@ -54,8 +54,8 @@ def test_basic_el_withdrawal_request(spec, state): @with_electra_and_later @spec_state_test def test_basic_btec_and_el_withdrawal_request_in_same_block(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield 'pre', state validator_index = 0 @@ -96,8 +96,8 @@ def test_basic_btec_and_el_withdrawal_request_in_same_block(spec, state): @with_electra_and_later @spec_state_test def test_basic_btec_before_el_withdrawal_request(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield 'pre', state @@ -143,8 +143,8 @@ def test_basic_btec_before_el_withdrawal_request(spec, state): @with_electra_and_later @spec_state_test def test_cl_exit_and_el_withdrawal_request_in_same_block(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield 'pre', state diff --git a/tests/core/pyspec/eth2spec/test/helpers/multi_operations.py b/tests/core/pyspec/eth2spec/test/helpers/multi_operations.py index 9943fcdd45..42115375bf 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/multi_operations.py +++ b/tests/core/pyspec/eth2spec/test/helpers/multi_operations.py @@ -23,8 +23,8 @@ def run_slash_and_exit(spec, state, slash_index, exit_index, valid=True): """ Helper function to run a test that slashes and exits two validators """ - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH yield 'pre', state @@ -162,7 +162,7 @@ def _eligible_for_exit(spec, state, index): current_epoch = spec.get_current_epoch(state) activation_epoch = validator.activation_epoch - active_for_long_enough = current_epoch >= activation_epoch + spec.config.SHARD_COMMITTEE_PERIOD + active_for_long_enough = current_epoch >= activation_epoch + spec.config.MIN_VALIDATOR_ACTIVE_PERIOD not_exited = validator.exit_epoch == spec.FAR_FUTURE_EPOCH @@ -244,8 +244,8 @@ def build_random_block_from_state_for_next_slot(spec, state, rng=Random(2188), d def run_test_full_random_operations(spec, state, rng=Random(2080)): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # prepare state for deposits before building block deposits = prepare_state_and_get_random_deposits(spec, state, rng) diff --git a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_voluntary_exit.py b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_voluntary_exit.py index 97208dfcdd..638ba084e5 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_voluntary_exit.py +++ b/tests/core/pyspec/eth2spec/test/phase0/block_processing/test_process_voluntary_exit.py @@ -16,8 +16,8 @@ @with_all_phases @spec_state_test def test_basic(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -35,8 +35,8 @@ def test_basic(spec, state): @spec_state_test @always_bls def test_invalid_incorrect_signature(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -51,8 +51,8 @@ def test_invalid_incorrect_signature(spec, state): def run_test_success_exit_queue(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) @@ -115,8 +115,8 @@ def test_success_exit_queue__scaled_churn(spec, state): @with_all_phases @spec_state_test def test_default_exit_epoch_subsequent_exit(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -137,8 +137,8 @@ def test_default_exit_epoch_subsequent_exit(spec, state): @with_all_phases @spec_state_test def test_invalid_validator_exit_in_future(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -156,8 +156,8 @@ def test_invalid_validator_exit_in_future(spec, state): @with_all_phases @spec_state_test def test_invalid_validator_incorrect_validator_index(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -190,8 +190,8 @@ def test_invalid_validator_not_active(spec, state): @with_all_phases @spec_state_test def test_invalid_validator_already_exited(spec, state): - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow validator able to exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow validator able to exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH current_epoch = spec.get_current_epoch(state) validator_index = spec.get_active_validator_indices(state, current_epoch)[0] @@ -218,7 +218,7 @@ def test_invalid_validator_not_active_long_enough(spec, state): assert ( current_epoch - state.validators[validator_index].activation_epoch < - spec.config.SHARD_COMMITTEE_PERIOD + spec.config.MIN_VALIDATOR_ACTIVE_PERIOD ) yield from run_voluntary_exit_processing(spec, state, signed_voluntary_exit, valid=False) 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 148cb939d5..9f79d1799b 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py @@ -915,7 +915,7 @@ def test_duplicate_attestation_same_block(spec, state): assert spec.hash_tree_root(state.previous_epoch_participation) == pre_current_epoch_participation_root -# After SHARDING is enabled, a committee is computed for SHARD_COMMITTEE_PERIOD slots ago, +# After SHARDING is enabled, a committee is computed for MIN_VALIDATOR_ACTIVE_PERIOD slots ago, # exceeding the minimal-config randao mixes memory size. # Applies to all voluntary-exit sanity block tests. # TODO: when integrating SHARDING tests, voluntary-exit tests may need to change. @@ -925,8 +925,8 @@ def test_duplicate_attestation_same_block(spec, state): def test_voluntary_exit(spec, state): validator_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1] - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH signed_exits = prepare_signed_exits(spec, state, [validator_index]) yield 'pre', state @@ -953,8 +953,8 @@ def test_voluntary_exit(spec, state): def test_invalid_duplicate_validator_exit_same_block(spec, state): validator_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1] - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH # Same index tries to exit twice, but should only be able to do so once. signed_exits = prepare_signed_exits(spec, state, [validator_index, validator_index]) @@ -976,8 +976,8 @@ def test_multiple_different_validator_exits_same_block(spec, state): spec.get_active_validator_indices(state, spec.get_current_epoch(state))[i] for i in range(3) ] - # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit - state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH + # move state forward MIN_VALIDATOR_ACTIVE_PERIOD epochs to allow for exit + state.slot += spec.config.MIN_VALIDATOR_ACTIVE_PERIOD * spec.SLOTS_PER_EPOCH signed_exits = prepare_signed_exits(spec, state, validator_indices) yield 'pre', state diff --git a/tests/core/pyspec/eth2spec/test/utils/randomized_block_tests.py b/tests/core/pyspec/eth2spec/test/utils/randomized_block_tests.py index 78802a6ddd..f0f960f79e 100644 --- a/tests/core/pyspec/eth2spec/test/utils/randomized_block_tests.py +++ b/tests/core/pyspec/eth2spec/test/utils/randomized_block_tests.py @@ -121,7 +121,7 @@ def epochs_until_leak(spec): def epochs_for_shard_committee_period(spec): - return spec.config.SHARD_COMMITTEE_PERIOD + return spec.config.MIN_VALIDATOR_ACTIVE_PERIOD # slots