@@ -151,6 +151,40 @@ def test_fork_has_compounding_withdrawal_credential(spec, phases, state):
151151 )]
152152
153153
154+ @with_phases (phases = [DENEB ], other_phases = [ELECTRA ])
155+ @spec_test
156+ @with_state
157+ @with_meta_tags (ELECTRA_FORK_TEST_META_TAGS )
158+ def test_fork_inactive_compounding_validator_with_excess_balance (spec , phases , state ):
159+ index = 0
160+ post_spec = phases [ELECTRA ]
161+ validator = state .validators [index ]
162+
163+ # set validator balance greater than min_activation_balance
164+ state .balances [index ] = post_spec .MIN_ACTIVATION_BALANCE + 1
165+ # set validator as not active yet
166+ validator .activation_epoch = spec .FAR_FUTURE_EPOCH
167+ # set validator activation eligibility epoch to the latest finalized epoch
168+ validator .activation_eligibility_epoch = state .finalized_checkpoint .epoch
169+ # give the validator compounding withdrawal credentials
170+ validator .withdrawal_credentials = post_spec .COMPOUNDING_WITHDRAWAL_PREFIX + validator .withdrawal_credentials [1 :]
171+
172+ post_state = yield from run_fork_test (post_spec , state )
173+
174+ # the validator cannot be activated again
175+ assert post_state .validators [index ].activation_eligibility_epoch == spec .FAR_FUTURE_EPOCH
176+ # the validator should now have a zero balance
177+ assert post_state .balances [index ] == 0
178+ # there should be a single pending deposit for this validator
179+ assert post_state .pending_deposits == [post_spec .PendingDeposit (
180+ pubkey = validator .pubkey ,
181+ withdrawal_credentials = validator .withdrawal_credentials ,
182+ amount = state .balances [index ],
183+ signature = spec .bls .G2_POINT_AT_INFINITY ,
184+ slot = spec .GENESIS_SLOT ,
185+ )]
186+
187+
154188@with_phases (phases = [DENEB ], other_phases = [ELECTRA ])
155189@spec_test
156190@with_state
0 commit comments