@@ -87,22 +87,41 @@ def test_fork_random_large_validator_set(spec, phases, state):
8787@with_state
8888@with_meta_tags (ELECTRA_FORK_TEST_META_TAGS )
8989def test_fork_pre_activation (spec , phases , state ):
90+ index = 0
9091 post_spec = phases [ELECTRA ]
91- state .validators [0 ].activation_epoch = spec .FAR_FUTURE_EPOCH
92+ state .validators [index ].activation_epoch = spec .FAR_FUTURE_EPOCH
9293 post_state = yield from run_fork_test (post_spec , state )
9394
94- assert len (post_state .pending_deposits ) > 0
95+ validator = post_state .validators [index ]
96+ assert post_state .balances [index ] == 0
97+ assert validator .effective_balance == 0
98+ assert validator .activation_eligibility_epoch == spec .FAR_FUTURE_EPOCH
99+ assert post_state .pending_deposits == [post_spec .PendingDeposit (
100+ pubkey = validator .pubkey ,
101+ withdrawal_credentials = validator .withdrawal_credentials ,
102+ amount = state .balances [index ],
103+ signature = spec .bls .G2_POINT_AT_INFINITY ,
104+ slot = spec .GENESIS_SLOT ,
105+ )]
95106
96107
97108@with_phases (phases = [DENEB ], other_phases = [ELECTRA ])
98109@spec_test
99110@with_state
100111@with_meta_tags (ELECTRA_FORK_TEST_META_TAGS )
101112def test_fork_has_compounding_withdrawal_credential (spec , phases , state ):
113+ index = 0
102114 post_spec = phases [ELECTRA ]
103- validator = state .validators [0 ]
104- state .balances [0 ] = post_spec .MIN_ACTIVATION_BALANCE + 1
115+ validator = state .validators [index ]
116+ state .balances [index ] = post_spec .MIN_ACTIVATION_BALANCE + 1
105117 validator .withdrawal_credentials = post_spec .COMPOUNDING_WITHDRAWAL_PREFIX + validator .withdrawal_credentials [1 :]
106118 post_state = yield from run_fork_test (post_spec , state )
107119
108- assert len (post_state .pending_deposits ) > 0
120+ assert post_state .balances [index ] == post_spec .MIN_ACTIVATION_BALANCE
121+ assert post_state .pending_deposits == [post_spec .PendingDeposit (
122+ pubkey = validator .pubkey ,
123+ withdrawal_credentials = validator .withdrawal_credentials ,
124+ amount = state .balances [index ] - post_spec .MIN_ACTIVATION_BALANCE ,
125+ signature = spec .bls .G2_POINT_AT_INFINITY ,
126+ slot = spec .GENESIS_SLOT ,
127+ )]
0 commit comments