@@ -113,7 +113,7 @@ def test_success_zero_expected_withdrawals(spec, state):
113113@spec_state_test
114114def test_success_one_full_withdrawal (spec , state ):
115115 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
116- spec , state , num_full_withdrawals = 1 )
116+ spec , state , rng = random . Random ( 42 ), num_full_withdrawals = 1 )
117117 assert len (fully_withdrawable_indices ) == 1
118118 assert len (partial_withdrawals_indices ) == 0
119119
@@ -130,7 +130,7 @@ def test_success_one_full_withdrawal(spec, state):
130130@spec_state_test
131131def test_success_one_partial_withdrawal (spec , state ):
132132 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
133- spec , state , num_partial_withdrawals = 1 )
133+ spec , state , rng = random . Random ( 42 ), num_partial_withdrawals = 1 )
134134 assert len (fully_withdrawable_indices ) == 0
135135 assert len (partial_withdrawals_indices ) == 1
136136 for index in partial_withdrawals_indices :
@@ -153,6 +153,7 @@ def test_success_mixed_fully_and_partial_withdrawable(spec, state):
153153 num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD - num_full_withdrawals
154154 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
155155 spec , state ,
156+ rng = random .Random (42 ),
156157 num_full_withdrawals = num_full_withdrawals ,
157158 num_partial_withdrawals = num_partial_withdrawals ,
158159 )
@@ -174,7 +175,7 @@ def test_success_all_fully_withdrawable_in_one_sweep(spec, state):
174175
175176 withdrawal_count = len (state .validators )
176177 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
177- spec , state , num_full_withdrawals = withdrawal_count )
178+ spec , state , rng = random . Random ( 42 ), num_full_withdrawals = withdrawal_count )
178179
179180 next_slot (spec , state )
180181 execution_payload = build_empty_execution_payload (spec , state )
@@ -193,7 +194,7 @@ def test_success_all_fully_withdrawable(spec, state):
193194
194195 withdrawal_count = spec .MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP
195196 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
196- spec , state , num_full_withdrawals = withdrawal_count )
197+ spec , state , rng = random . Random ( 42 ), num_full_withdrawals = withdrawal_count )
197198
198199 next_slot (spec , state )
199200 execution_payload = build_empty_execution_payload (spec , state )
@@ -212,7 +213,7 @@ def test_success_all_partially_withdrawable_in_one_sweep(spec, state):
212213
213214 withdrawal_count = len (state .validators )
214215 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
215- spec , state , num_partial_withdrawals = withdrawal_count )
216+ spec , state , rng = random . Random ( 42 ), num_partial_withdrawals = withdrawal_count )
216217
217218 next_slot (spec , state )
218219 execution_payload = build_empty_execution_payload (spec , state )
@@ -231,7 +232,7 @@ def test_success_all_partially_withdrawable(spec, state):
231232
232233 withdrawal_count = spec .MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP
233234 fully_withdrawable_indices , partial_withdrawals_indices = prepare_expected_withdrawals (
234- spec , state , num_partial_withdrawals = withdrawal_count )
235+ spec , state , rng = random . Random ( 42 ), num_partial_withdrawals = withdrawal_count )
235236
236237 next_slot (spec , state )
237238 execution_payload = build_empty_execution_payload (spec , state )
@@ -266,7 +267,7 @@ def test_invalid_non_withdrawable_non_empty_withdrawals(spec, state):
266267@with_capella_and_later
267268@spec_state_test
268269def test_invalid_one_expected_full_withdrawal_and_none_in_withdrawals (spec , state ):
269- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 1 )
270+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_full_withdrawals = 1 )
270271
271272 next_slot (spec , state )
272273 execution_payload = build_empty_execution_payload (spec , state )
@@ -279,7 +280,7 @@ def test_invalid_one_expected_full_withdrawal_and_none_in_withdrawals(spec, stat
279280@with_capella_and_later
280281@spec_state_test
281282def test_invalid_one_expected_partial_withdrawal_and_none_in_withdrawals (spec , state ):
282- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = 1 )
283+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_partial_withdrawals = 1 )
283284
284285 next_slot (spec , state )
285286 execution_payload = build_empty_execution_payload (spec , state )
@@ -292,7 +293,7 @@ def test_invalid_one_expected_partial_withdrawal_and_none_in_withdrawals(spec, s
292293@with_capella_and_later
293294@spec_state_test
294295def test_invalid_one_expected_full_withdrawal_and_duplicate_in_withdrawals (spec , state ):
295- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 2 )
296+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_full_withdrawals = 2 )
296297
297298 next_slot (spec , state )
298299 execution_payload = build_empty_execution_payload (spec , state )
@@ -305,7 +306,7 @@ def test_invalid_one_expected_full_withdrawal_and_duplicate_in_withdrawals(spec,
305306@with_capella_and_later
306307@spec_state_test
307308def test_invalid_two_expected_partial_withdrawal_and_duplicate_in_withdrawals (spec , state ):
308- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = 2 )
309+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_partial_withdrawals = 2 )
309310
310311 next_slot (spec , state )
311312 execution_payload = build_empty_execution_payload (spec , state )
@@ -318,7 +319,8 @@ def test_invalid_two_expected_partial_withdrawal_and_duplicate_in_withdrawals(sp
318319@with_capella_and_later
319320@spec_state_test
320321def test_invalid_max_per_slot_full_withdrawals_and_one_less_in_withdrawals (spec , state ):
321- prepare_expected_withdrawals (spec , state , num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD )
322+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
323+ num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD )
322324
323325 next_slot (spec , state )
324326 execution_payload = build_empty_execution_payload (spec , state )
@@ -331,7 +333,8 @@ def test_invalid_max_per_slot_full_withdrawals_and_one_less_in_withdrawals(spec,
331333@with_capella_and_later
332334@spec_state_test
333335def test_invalid_max_per_slot_partial_withdrawals_and_one_less_in_withdrawals (spec , state ):
334- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD )
336+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
337+ num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD )
335338
336339 next_slot (spec , state )
337340 execution_payload = build_empty_execution_payload (spec , state )
@@ -344,7 +347,8 @@ def test_invalid_max_per_slot_partial_withdrawals_and_one_less_in_withdrawals(sp
344347@with_capella_and_later
345348@spec_state_test
346349def test_invalid_a_lot_fully_withdrawable_too_few_in_withdrawals (spec , state ):
347- prepare_expected_withdrawals (spec , state , num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
350+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
351+ num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
348352
349353 next_slot (spec , state )
350354 execution_payload = build_empty_execution_payload (spec , state )
@@ -357,7 +361,8 @@ def test_invalid_a_lot_fully_withdrawable_too_few_in_withdrawals(spec, state):
357361@with_capella_and_later
358362@spec_state_test
359363def test_invalid_a_lot_partially_withdrawable_too_few_in_withdrawals (spec , state ):
360- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
364+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
365+ num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
361366
362367 next_slot (spec , state )
363368 execution_payload = build_empty_execution_payload (spec , state )
@@ -370,7 +375,8 @@ def test_invalid_a_lot_partially_withdrawable_too_few_in_withdrawals(spec, state
370375@with_capella_and_later
371376@spec_state_test
372377def test_invalid_a_lot_mixed_withdrawable_in_queue_too_few_in_withdrawals (spec , state ):
373- prepare_expected_withdrawals (spec , state , num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD ,
378+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
379+ num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD ,
374380 num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD )
375381
376382 next_slot (spec , state )
@@ -388,7 +394,8 @@ def test_invalid_a_lot_mixed_withdrawable_in_queue_too_few_in_withdrawals(spec,
388394@with_capella_and_later
389395@spec_state_test
390396def test_invalid_incorrect_withdrawal_index (spec , state ):
391- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 1 )
397+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
398+ num_full_withdrawals = 1 )
392399
393400 next_slot (spec , state )
394401 execution_payload = build_empty_execution_payload (spec , state )
@@ -401,7 +408,8 @@ def test_invalid_incorrect_withdrawal_index(spec, state):
401408@with_capella_and_later
402409@spec_state_test
403410def test_invalid_incorrect_address_full (spec , state ):
404- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 1 )
411+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
412+ num_full_withdrawals = 1 )
405413
406414 next_slot (spec , state )
407415 execution_payload = build_empty_execution_payload (spec , state )
@@ -414,7 +422,8 @@ def test_invalid_incorrect_address_full(spec, state):
414422@with_capella_and_later
415423@spec_state_test
416424def test_invalid_incorrect_address_partial (spec , state ):
417- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = 1 )
425+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
426+ num_partial_withdrawals = 1 )
418427
419428 next_slot (spec , state )
420429 execution_payload = build_empty_execution_payload (spec , state )
@@ -427,7 +436,7 @@ def test_invalid_incorrect_address_partial(spec, state):
427436@with_capella_and_later
428437@spec_state_test
429438def test_invalid_incorrect_amount_full (spec , state ):
430- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 1 )
439+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_full_withdrawals = 1 )
431440
432441 next_slot (spec , state )
433442 execution_payload = build_empty_execution_payload (spec , state )
@@ -440,7 +449,7 @@ def test_invalid_incorrect_amount_full(spec, state):
440449@with_capella_and_later
441450@spec_state_test
442451def test_invalid_incorrect_amount_partial (spec , state ):
443- prepare_expected_withdrawals (spec , state , num_full_withdrawals = 1 )
452+ prepare_expected_withdrawals (spec , state , rng = random . Random ( 42 ), num_full_withdrawals = 1 )
444453
445454 next_slot (spec , state )
446455 execution_payload = build_empty_execution_payload (spec , state )
@@ -453,7 +462,8 @@ def test_invalid_incorrect_amount_partial(spec, state):
453462@with_capella_and_later
454463@spec_state_test
455464def test_invalid_one_of_many_incorrectly_full (spec , state ):
456- prepare_expected_withdrawals (spec , state , num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
465+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
466+ num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
457467
458468 next_slot (spec , state )
459469 execution_payload = build_empty_execution_payload (spec , state )
@@ -472,7 +482,8 @@ def test_invalid_one_of_many_incorrectly_full(spec, state):
472482@with_capella_and_later
473483@spec_state_test
474484def test_invalid_one_of_many_incorrectly_partial (spec , state ):
475- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
485+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
486+ num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
476487
477488 next_slot (spec , state )
478489 execution_payload = build_empty_execution_payload (spec , state )
@@ -491,7 +502,8 @@ def test_invalid_one_of_many_incorrectly_partial(spec, state):
491502@with_capella_and_later
492503@spec_state_test
493504def test_invalid_many_incorrectly_full (spec , state ):
494- prepare_expected_withdrawals (spec , state , num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
505+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
506+ num_full_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
495507
496508 next_slot (spec , state )
497509 execution_payload = build_empty_execution_payload (spec , state )
@@ -510,7 +522,8 @@ def test_invalid_many_incorrectly_full(spec, state):
510522@with_capella_and_later
511523@spec_state_test
512524def test_invalid_many_incorrectly_partial (spec , state ):
513- prepare_expected_withdrawals (spec , state , num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
525+ prepare_expected_withdrawals (spec , state , rng = random .Random (42 ),
526+ num_partial_withdrawals = spec .MAX_WITHDRAWALS_PER_PAYLOAD * 4 )
514527
515528 next_slot (spec , state )
516529 execution_payload = build_empty_execution_payload (spec , state )
0 commit comments