Skip to content

Commit c1a3b86

Browse files
authored
Merge pull request #3960 from jtraglia/fix-alpha-7-tests
Move yield pre-state after pre-state setup
2 parents 7df1ce3 + 745b4dd commit c1a3b86

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/core/pyspec/eth2spec/test/electra/sanity/blocks/test_blocks.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def test_basic_el_withdrawal_request(spec, state):
2828
# move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
2929
state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
3030

31-
yield 'pre', state
32-
3331
validator_index = 0
3432
address = b'\x22' * 20
3533
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
3634
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
3735

36+
yield 'pre', state
37+
3838
validator_pubkey = state.validators[validator_index].pubkey
3939
withdrawal_request = spec.WithdrawalRequest(
4040
source_address=address,
@@ -57,10 +57,11 @@ def test_basic_btec_and_el_withdrawal_request_in_same_block(spec, state):
5757
# move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
5858
state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
5959

60-
yield 'pre', state
6160
validator_index = 0
6261
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
6362

63+
yield 'pre', state
64+
6465
block = build_empty_block_for_next_slot(spec, state)
6566

6667
address = b'\x22' * 20
@@ -99,11 +100,11 @@ def test_basic_btec_before_el_withdrawal_request(spec, state):
99100
# move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
100101
state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
101102

102-
yield 'pre', state
103-
104103
validator_index = 0
105104
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
106105

106+
yield 'pre', state
107+
107108
# block_1 contains a BTEC operation of the given validator
108109
address = b'\x22' * 20
109110
signed_address_change = get_signed_address_change(
@@ -146,13 +147,13 @@ def test_cl_exit_and_el_withdrawal_request_in_same_block(spec, state):
146147
# move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
147148
state.slot += spec.config.SHARD_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
148149

149-
yield 'pre', state
150-
151150
validator_index = 0
152151
address = b'\x22' * 20
153152
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
154153
assert state.validators[validator_index].exit_epoch == spec.FAR_FUTURE_EPOCH
155154

155+
yield 'pre', state
156+
156157
# CL-Exit
157158
signed_voluntary_exits = prepare_signed_exits(spec, state, indices=[validator_index])
158159
# EL-Exit

0 commit comments

Comments
 (0)