From 2ecbe194f7411dc298e58045fed4167bc8ceb110 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Wed, 17 Apr 2024 01:00:32 +0800 Subject: [PATCH 1/2] Delete duplicate deposit tests and enable testgen --- tests/generators/epoch_processing/main.py | 7 ++++++- tests/generators/operations/main.py | 14 +++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/generators/epoch_processing/main.py b/tests/generators/epoch_processing/main.py index 93e9a366c..3796f76a9 100644 --- a/tests/generators/epoch_processing/main.py +++ b/tests/generators/epoch_processing/main.py @@ -37,7 +37,12 @@ if __name__ == "__main__": ]} deneb_mods = combine_mods(_new_deneb_mods, capella_mods) - electra_mods = deneb_mods + _new_electra_mods = {key: 'eth2spec.test.electra.epoch_processing.test_process_' + key for key in [ + 'effective_balance_updates', + 'pending_balance_deposits', + 'pending_consolidations', + ]} + electra_mods = combine_mods(_new_electra_mods, deneb_mods) # TODO Custody Game testgen is disabled for now # custody_game_mods = {**{key: 'eth2spec.test.custody_game.epoch_processing.test_process_' + key for key in [ diff --git a/tests/generators/operations/main.py b/tests/generators/operations/main.py index 42d698c75..fc4a8c2bf 100644 --- a/tests/generators/operations/main.py +++ b/tests/generators/operations/main.py @@ -45,21 +45,13 @@ if __name__ == "__main__": _new_electra_mods = {key: 'eth2spec.test.electra.block_processing.test_process_' + key for key in [ 'attestation', + 'consolidation' 'deposit_receipt', - 'execution_layer_exit', + 'execution_layer_withdrawal_request', + 'voluntary_exit' ]} electra_mods = combine_mods(_new_electra_mods, deneb_mods) - # TODO Custody Game testgen is disabled for now - # _new_custody_game_mods = {key: 'eth2spec.test.custody_game.block_processing.test_process_' + key for key in [ - # 'attestation', - # 'chunk_challenge', - # 'custody_key_reveal', - # 'custody_slashing', - # 'early_derived_secret_reveal', - # ]} - # custody_game_mods = combine_mods(_new_custody_game_mods, phase0_mods) - all_mods = { PHASE0: phase_0_mods, ALTAIR: altair_mods, From b290ec7d0c81afb8ed2112c96e69b6bbfe5f100f Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Wed, 17 Apr 2024 18:40:38 +0800 Subject: [PATCH 2/2] fix `test_top_up_and_partial_withdrawable_validator`: set different expected value for post-electra --- .../test/capella/sanity/test_blocks.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 6da7b3d41..874b13bd1 100644 --- a/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py @@ -359,17 +359,17 @@ def test_top_up_and_partial_withdrawable_validator(spec, state): signed_block = state_transition_and_sign_block(spec, state, block) - # ensure we go through an epoch transition, to account for post-electra behavior - block_in_next_epoch = build_empty_block(spec, state, slot=state.slot + spec.SLOTS_PER_EPOCH) - signed_block_in_next_epoch = state_transition_and_sign_block(spec, state, block_in_next_epoch) - - yield 'blocks', [signed_block, signed_block_in_next_epoch] + yield 'blocks', [signed_block] yield 'post', state - # Since withdrawals happen before deposits, it becomes partially withdrawable after state transition. - validator = state.validators[validator_index] - balance = state.balances[validator_index] - assert spec.is_partially_withdrawable_validator(validator, balance) + if is_post_electra(spec): + assert state.pending_balance_deposits[0].amount == amount + assert state.pending_balance_deposits[0].index == validator_index + else: + # Since withdrawals happen before deposits, it becomes partially withdrawable after state transition. + validator = state.validators[validator_index] + balance = state.balances[validator_index] + assert spec.is_partially_withdrawable_validator(validator, balance) @with_capella_and_later