From 28286e7e5fc5a006cc9f2ca9051887d8551cf7c9 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 14 Sep 2023 19:05:31 +0800 Subject: [PATCH] Fix tests --- .../test_process_registry_updates.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/eip7668/epoch_processing/test_process_registry_updates.py b/tests/core/pyspec/eth2spec/test/eip7668/epoch_processing/test_process_registry_updates.py index fb0fa2ef0..d68a659ef 100644 --- a/tests/core/pyspec/eth2spec/test/eip7668/epoch_processing/test_process_registry_updates.py +++ b/tests/core/pyspec/eth2spec/test/eip7668/epoch_processing/test_process_registry_updates.py @@ -18,10 +18,12 @@ def run_process_registry_updates(spec, state): def run_test_inbound_churn_limit(spec, state): - mock_activations = 1 + mock_activations = spec.get_validator_activation_churn_limit(state) * 2 + + validator_count_0 = len(state.validators) for i in range(mock_activations): - index = len(state.validators) + i + index = validator_count_0 + i validator = spec.Validator( pubkey=pubkeys[index], withdrawal_credentials=spec.ETH1_ADDRESS_WITHDRAWAL_PREFIX + b'\x00' * 11 + b'\x56' * 20, @@ -44,10 +46,12 @@ def run_test_inbound_churn_limit(spec, state): # Half should churn in first run of registry update for i in range(mock_activations): - if i < churn_limit_0: - assert state.validators[i].activation_epoch < spec.FAR_FUTURE_EPOCH + index = validator_count_0 + i + if index < validator_count_0 + churn_limit_0: + # The eligible validators within the activation churn limit should have been activated + assert state.validators[index].activation_epoch < spec.FAR_FUTURE_EPOCH else: - assert state.validators[i].activation_epoch == spec.FAR_FUTURE_EPOCH + assert state.validators[index].activation_epoch == spec.FAR_FUTURE_EPOCH @with_eip7668_and_later