Merge pull request #3681 from ethereum/electra-testgen

Fix electra tests and enable testgen
This commit is contained in:
Alex Stokes 2024-04-17 13:47:16 -06:00 committed by GitHub
commit 714c54af7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 21 deletions

View File

@ -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

View File

@ -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 [

View File

@ -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,