Move yield pre-state after state setup

This commit is contained in:
Justin Traglia 2024-10-07 07:24:13 -05:00
parent 7df1ce3038
commit 745b4dd3db
No known key found for this signature in database
GPG Key ID: F099C9CD25DF82A1
1 changed files with 8 additions and 7 deletions

View File

@ -28,13 +28,13 @@ 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
yield 'pre', state
validator_index = 0
address = b'\x22' * 20
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
yield 'pre', state
validator_pubkey = state.validators[validator_index].pubkey
withdrawal_request = spec.WithdrawalRequest(
source_address=address,
@ -57,10 +57,11 @@ 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
yield 'pre', state
validator_index = 0
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
yield 'pre', state
block = build_empty_block_for_next_slot(spec, state)
address = b'\x22' * 20
@ -99,11 +100,11 @@ 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
yield 'pre', state
validator_index = 0
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
yield 'pre', state
# block_1 contains a BTEC operation of the given validator
address = b'\x22' * 20
signed_address_change = get_signed_address_change(
@ -146,13 +147,13 @@ 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
yield 'pre', state
validator_index = 0
address = b'\x22' * 20
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
yield 'pre', state
# CL-Exit
signed_voluntary_exits = prepare_signed_exits(spec, state, indices=[validator_index])
# EL-Exit