Skip to content

Commit 090d349

Browse files
authored
Merge pull request #3764 from ethereum/electra-fork-tests
Add more Electra fork tests
2 parents 83da380 + 8b26470 commit 090d349

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/core/pyspec/eth2spec/test/electra/fork/test_electra_fork_basic.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,29 @@ def test_fork_random_misc_balances(spec, phases, state):
8080
@with_meta_tags(ELECTRA_FORK_TEST_META_TAGS)
8181
def test_fork_random_large_validator_set(spec, phases, state):
8282
yield from run_fork_test(phases[ELECTRA], state)
83+
84+
85+
@with_phases(phases=[DENEB], other_phases=[ELECTRA])
86+
@spec_test
87+
@with_state
88+
@with_meta_tags(ELECTRA_FORK_TEST_META_TAGS)
89+
def test_fork_pre_activation(spec, phases, state):
90+
post_spec = phases[ELECTRA]
91+
state.validators[0].activation_epoch = spec.FAR_FUTURE_EPOCH
92+
post_state = yield from run_fork_test(post_spec, state)
93+
94+
assert len(post_state.pending_balance_deposits) > 0
95+
96+
97+
@with_phases(phases=[DENEB], other_phases=[ELECTRA])
98+
@spec_test
99+
@with_state
100+
@with_meta_tags(ELECTRA_FORK_TEST_META_TAGS)
101+
def test_fork_has_compounding_withdrawal_credential(spec, phases, state):
102+
post_spec = phases[ELECTRA]
103+
validator = state.validators[0]
104+
state.balances[0] = post_spec.MIN_ACTIVATION_BALANCE + 1
105+
validator.withdrawal_credentials = post_spec.COMPOUNDING_WITHDRAWAL_PREFIX + validator.withdrawal_credentials[1:]
106+
post_state = yield from run_fork_test(post_spec, state)
107+
108+
assert len(post_state.pending_balance_deposits) > 0

tests/core/pyspec/eth2spec/test/helpers/electra/fork.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ def run_fork_test(post_spec, pre_state):
6363
assert post_state.fork.epoch == post_spec.get_current_epoch(post_state)
6464

6565
yield 'post', post_state
66+
67+
return post_state

0 commit comments

Comments
 (0)