Skip to content

Commit ad42273

Browse files
committed
Use pending_deposits format for both test files
1 parent 3befc42 commit ad42273

File tree

5 files changed

+49
-41
lines changed

5 files changed

+49
-41
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This is a trick to allow tests be split into multiple files and use the same test format.
2+
from .test_apply_pending_deposit import * # noqa: F401 F403
3+
from .test_process_pending_deposits import * # noqa: F401 F403

tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposit.py renamed to tests/core/pyspec/eth2spec/test/electra/epoch_processing/pending_deposits/test_apply_pending_deposit.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@with_electra_and_later
1515
@spec_state_test
16-
def test_process_pending_deposit_under_min_activation(spec, state):
16+
def test_apply_pending_deposit_under_min_activation(spec, state):
1717
# fresh deposit = next validator index = validator appended to registry
1818
validator_index = len(state.validators)
1919
# effective balance will be 1 EFFECTIVE_BALANCE_INCREMENT smaller because of this small decrement.
@@ -25,7 +25,7 @@ def test_process_pending_deposit_under_min_activation(spec, state):
2525

2626
@with_electra_and_later
2727
@spec_state_test
28-
def test_process_pending_deposit_min_activation(spec, state):
28+
def test_apply_pending_deposit_min_activation(spec, state):
2929
# fresh deposit = next validator index = validator appended to registry
3030
validator_index = len(state.validators)
3131
# effective balance will be exactly the same as balance.
@@ -37,7 +37,7 @@ def test_process_pending_deposit_min_activation(spec, state):
3737

3838
@with_electra_and_later
3939
@spec_state_test
40-
def test_process_pending_deposit_over_min_activation(spec, state):
40+
def test_apply_pending_deposit_over_min_activation(spec, state):
4141
# fresh deposit = next validator index = validator appended to registry
4242
validator_index = len(state.validators)
4343
# just 1 over the limit, effective balance should be set MIN_ACTIVATION_BALANCE during processing
@@ -49,7 +49,7 @@ def test_process_pending_deposit_over_min_activation(spec, state):
4949

5050
@with_electra_and_later
5151
@spec_state_test
52-
def test_process_pending_deposit_eth1_withdrawal_credentials(spec, state):
52+
def test_apply_pending_deposit_eth1_withdrawal_credentials(spec, state):
5353
# fresh deposit = next validator index = validator appended to registry
5454
validator_index = len(state.validators)
5555
withdrawal_credentials = (
@@ -71,7 +71,7 @@ def test_process_pending_deposit_eth1_withdrawal_credentials(spec, state):
7171

7272
@with_electra_and_later
7373
@spec_state_test
74-
def test_process_pending_deposit_compounding_withdrawal_credentials_under_max(spec, state):
74+
def test_apply_pending_deposit_compounding_withdrawal_credentials_under_max(spec, state):
7575
# fresh deposit = next validator index = validator appended to registry
7676
validator_index = len(state.validators)
7777
withdrawal_credentials = (
@@ -94,7 +94,7 @@ def test_process_pending_deposit_compounding_withdrawal_credentials_under_max(sp
9494

9595
@with_electra_and_later
9696
@spec_state_test
97-
def test_process_pending_deposit_compounding_withdrawal_credentials_max(spec, state):
97+
def test_apply_pending_deposit_compounding_withdrawal_credentials_max(spec, state):
9898
# fresh deposit = next validator index = validator appended to registry
9999
validator_index = len(state.validators)
100100
withdrawal_credentials = (
@@ -117,7 +117,7 @@ def test_process_pending_deposit_compounding_withdrawal_credentials_max(spec, st
117117

118118
@with_electra_and_later
119119
@spec_state_test
120-
def test_process_pending_deposit_compounding_withdrawal_credentials_over_max(spec, state):
120+
def test_apply_pending_deposit_compounding_withdrawal_credentials_over_max(spec, state):
121121
# fresh deposit = next validator index = validator appended to registry
122122
validator_index = len(state.validators)
123123
withdrawal_credentials = (
@@ -140,7 +140,7 @@ def test_process_pending_deposit_compounding_withdrawal_credentials_over_max(spe
140140

141141
@with_electra_and_later
142142
@spec_state_test
143-
def test_process_pending_deposit_non_versioned_withdrawal_credentials(spec, state):
143+
def test_apply_pending_deposit_non_versioned_withdrawal_credentials(spec, state):
144144
# fresh deposit = next validator index = validator appended to registry
145145
validator_index = len(state.validators)
146146
withdrawal_credentials = (
@@ -161,7 +161,7 @@ def test_process_pending_deposit_non_versioned_withdrawal_credentials(spec, stat
161161

162162
@with_electra_and_later
163163
@spec_state_test
164-
def test_process_pending_deposit_non_versioned_withdrawal_credentials_over_min_activation(spec, state):
164+
def test_apply_pending_deposit_non_versioned_withdrawal_credentials_over_min_activation(spec, state):
165165
# fresh deposit = next validator index = validator appended to registry
166166
validator_index = len(state.validators)
167167
withdrawal_credentials = (
@@ -184,7 +184,7 @@ def test_process_pending_deposit_non_versioned_withdrawal_credentials_over_min_a
184184
@with_electra_and_later
185185
@spec_state_test
186186
@always_bls
187-
def test_process_pending_deposit_correct_sig_but_forked_state(spec, state):
187+
def test_apply_pending_deposit_correct_sig_but_forked_state(spec, state):
188188
validator_index = len(state.validators)
189189
amount = spec.MIN_ACTIVATION_BALANCE
190190
# deposits will always be valid, regardless of the current fork
@@ -196,7 +196,7 @@ def test_process_pending_deposit_correct_sig_but_forked_state(spec, state):
196196
@with_electra_and_later
197197
@spec_state_test
198198
@always_bls
199-
def test_process_pending_deposit_incorrect_sig_new_deposit(spec, state):
199+
def test_apply_pending_deposit_incorrect_sig_new_deposit(spec, state):
200200
# fresh deposit = next validator index = validator appended to registry
201201
validator_index = len(state.validators)
202202
amount = spec.MIN_ACTIVATION_BALANCE
@@ -206,7 +206,7 @@ def test_process_pending_deposit_incorrect_sig_new_deposit(spec, state):
206206

207207
@with_electra_and_later
208208
@spec_state_test
209-
def test_process_pending_deposit_top_up__min_activation_balance(spec, state):
209+
def test_apply_pending_deposit_top_up__min_activation_balance(spec, state):
210210
validator_index = 0
211211
amount = spec.MIN_ACTIVATION_BALANCE // 4
212212
pending_deposit = prepare_pending_deposit(spec, validator_index, amount, signed=True)
@@ -222,7 +222,7 @@ def test_process_pending_deposit_top_up__min_activation_balance(spec, state):
222222

223223
@with_electra_and_later
224224
@spec_state_test
225-
def test_process_pending_deposit_top_up__min_activation_balance_compounding(spec, state):
225+
def test_apply_pending_deposit_top_up__min_activation_balance_compounding(spec, state):
226226
validator_index = 0
227227
withdrawal_credentials = (
228228
spec.COMPOUNDING_WITHDRAWAL_PREFIX
@@ -244,7 +244,7 @@ def test_process_pending_deposit_top_up__min_activation_balance_compounding(spec
244244

245245
@with_electra_and_later
246246
@spec_state_test
247-
def test_process_pending_deposit_top_up__max_effective_balance_compounding(spec, state):
247+
def test_apply_pending_deposit_top_up__max_effective_balance_compounding(spec, state):
248248
validator_index = 0
249249
withdrawal_credentials = (
250250
spec.COMPOUNDING_WITHDRAWAL_PREFIX
@@ -266,7 +266,7 @@ def test_process_pending_deposit_top_up__max_effective_balance_compounding(spec,
266266

267267
@with_electra_and_later
268268
@spec_state_test
269-
def test_process_pending_deposit_top_up__less_effective_balance(spec, state):
269+
def test_apply_pending_deposit_top_up__less_effective_balance(spec, state):
270270
validator_index = 0
271271
amount = spec.MIN_ACTIVATION_BALANCE // 4
272272
pending_deposit = prepare_pending_deposit(spec, validator_index, amount, signed=True)
@@ -285,7 +285,7 @@ def test_process_pending_deposit_top_up__less_effective_balance(spec, state):
285285

286286
@with_electra_and_later
287287
@spec_state_test
288-
def test_process_pending_deposit_top_up__zero_balance(spec, state):
288+
def test_apply_pending_deposit_top_up__zero_balance(spec, state):
289289
validator_index = 0
290290
amount = spec.MIN_ACTIVATION_BALANCE // 4
291291
pending_deposit = prepare_pending_deposit(spec, validator_index, amount, signed=True)
@@ -305,7 +305,7 @@ def test_process_pending_deposit_top_up__zero_balance(spec, state):
305305
@with_electra_and_later
306306
@spec_state_test
307307
@always_bls
308-
def test_process_pending_deposit_incorrect_sig_top_up(spec, state):
308+
def test_apply_pending_deposit_incorrect_sig_top_up(spec, state):
309309
validator_index = 0
310310
amount = spec.MIN_ACTIVATION_BALANCE // 4
311311
pending_deposit = prepare_pending_deposit(spec, validator_index, amount, signed=True)
@@ -316,7 +316,7 @@ def test_process_pending_deposit_incorrect_sig_top_up(spec, state):
316316

317317
@with_electra_and_later
318318
@spec_state_test
319-
def test_process_pending_deposit_incorrect_withdrawal_credentials_top_up(spec, state):
319+
def test_apply_pending_deposit_incorrect_withdrawal_credentials_top_up(spec, state):
320320
validator_index = 0
321321
amount = spec.MIN_ACTIVATION_BALANCE // 4
322322
withdrawal_credentials = spec.BLS_WITHDRAWAL_PREFIX + spec.hash(b"junk")[1:]
@@ -335,7 +335,7 @@ def test_process_pending_deposit_incorrect_withdrawal_credentials_top_up(spec, s
335335
@with_electra_and_later
336336
@spec_state_test
337337
@always_bls
338-
def test_process_pending_deposit_key_validate_invalid_subgroup(spec, state):
338+
def test_apply_pending_deposit_key_validate_invalid_subgroup(spec, state):
339339
validator_index = len(state.validators)
340340
amount = spec.MIN_ACTIVATION_BALANCE
341341

@@ -350,7 +350,7 @@ def test_process_pending_deposit_key_validate_invalid_subgroup(spec, state):
350350
@with_electra_and_later
351351
@spec_state_test
352352
@always_bls
353-
def test_process_pending_deposit_key_validate_invalid_decompression(spec, state):
353+
def test_apply_pending_deposit_key_validate_invalid_decompression(spec, state):
354354
validator_index = len(state.validators)
355355
amount = spec.MIN_ACTIVATION_BALANCE
356356

@@ -367,7 +367,7 @@ def test_process_pending_deposit_key_validate_invalid_decompression(spec, state)
367367
@with_electra_and_later
368368
@spec_state_test
369369
@always_bls
370-
def test_process_pending_deposit_ineffective_deposit_with_bad_fork_version(spec, state):
370+
def test_apply_pending_deposit_ineffective_deposit_with_bad_fork_version(spec, state):
371371
validator_index = len(state.validators)
372372
fork_version = spec.Version('0xAaBbCcDd')
373373
pending_deposit = prepare_pending_deposit(
@@ -384,7 +384,7 @@ def test_process_pending_deposit_ineffective_deposit_with_bad_fork_version(spec,
384384
@with_electra_and_later
385385
@spec_state_test
386386
@always_bls
387-
def test_process_pending_deposit_with_previous_fork_version(spec, state):
387+
def test_apply_pending_deposit_with_previous_fork_version(spec, state):
388388
# Since deposits are valid across forks, the domain is always set with `GENESIS_FORK_VERSION`.
389389
# It's an ineffective deposit because it fails at BLS sig verification.
390390
# NOTE: it was effective in Altair.
@@ -423,7 +423,7 @@ def test_ineffective_deposit_with_current_fork_version(spec, state):
423423
@with_electra_and_later
424424
@spec_state_test
425425
@always_bls
426-
def test_process_pending_deposit_effective_deposit_with_genesis_fork_version(spec, state):
426+
def test_apply_pending_deposit_effective_deposit_with_genesis_fork_version(spec, state):
427427
assert spec.config.GENESIS_FORK_VERSION not in (state.fork.previous_version, state.fork.current_version)
428428

429429
validator_index = len(state.validators)
@@ -441,7 +441,7 @@ def test_process_pending_deposit_effective_deposit_with_genesis_fork_version(spe
441441

442442
@with_electra_and_later
443443
@spec_state_test
444-
def test_process_pending_deposit_success_top_up_to_withdrawn_validator(spec, state):
444+
def test_apply_pending_deposit_success_top_up_to_withdrawn_validator(spec, state):
445445
validator_index = 0
446446

447447
# Fully withdraw validator

tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposits.py renamed to tests/core/pyspec/eth2spec/test/electra/epoch_processing/pending_deposits/test_process_pending_deposits.py

File renamed without changes.

tests/formats/epoch_processing/README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ The provided pre-state is already transitioned to just before the specific sub-t
3232

3333
Sub-transitions:
3434

35-
- `justification_and_finalization`
36-
- `inactivity_updates` (Altair)
37-
- `rewards_and_penalties`
38-
- `registry_updates`
39-
- `slashings`
40-
- `eth1_data_reset`
41-
- `effective_balance_updates`
42-
- `slashings_reset`
43-
- `randao_mixes_reset`
44-
- `historical_roots_update` (Phase0, Altair, Bellatrix only)
45-
- `historical_summaries_update` (Capella)
46-
- `participation_record_updates` (Phase 0 only)
47-
- `participation_flag_updates` (Altair)
48-
- `sync_committee_updates` (Altair)
35+
- `eth1_data_reset` (>=Phase0)
36+
- `historical_roots_update` (>=Phase0,<=Bellatrix)
37+
- `justification_and_finalization` (>=Phase0)
38+
- `participation_record_updates` (==Phase0)
39+
- `randao_mixes_reset` (>=Phase0)
40+
- `registry_updates` (>=Phase0)
41+
- `rewards_and_penalties` (>=Phase0)
42+
- `slashings_reset` (>=Phase0)
43+
- `slashings` (>=Phase0)
44+
- `inactivity_updates` (>=Altair)
45+
- `participation_flag_updates` (>=Altair)
46+
- `sync_committee_updates` (>=Altair)
47+
- `historical_summaries_update` (>=Capella)
48+
- `effective_balance_updates` (>=Electra)
49+
- `pending_consolidations` (>=Electra)
50+
- `pending_deposits` (>=Electra)
4951

5052
The resulting state should match the expected `post` state.

tests/generators/epoch_processing/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@
3737
]}
3838
deneb_mods = combine_mods(_new_deneb_mods, capella_mods)
3939

40-
_new_electra_mods = {key: 'eth2spec.test.electra.epoch_processing.test_process_' + key for key in [
40+
_new_electra_mods_1 = {key: 'eth2spec.test.electra.epoch_processing.test_process_' + key for key in [
4141
'effective_balance_updates',
42-
'pending_deposit',
43-
'pending_deposits',
4442
'pending_consolidations',
4543
]}
44+
# This is a trick to allow tests be split into multiple files and use the same test format.
45+
_new_electra_mods_2 = {key: 'eth2spec.test.electra.epoch_processing.' + key for key in [
46+
'pending_deposits',
47+
]}
48+
_new_electra_mods = {**_new_electra_mods_1, **_new_electra_mods_2}
4649
electra_mods = combine_mods(_new_electra_mods, deneb_mods)
4750

4851
# TODO Custody Game testgen is disabled for now

0 commit comments

Comments
 (0)