@@ -407,88 +407,3 @@ def run_deposit_receipt_processing_with_specific_fork_version(
407407 valid = valid ,
408408 effective = effective
409409 )
410-
411-
412- # ********************
413- # * EIP7251 *
414- # ********************
415-
416-
417- def run_deposit_processing_eip7251 (spec , state , deposit , validator_index , valid = True , effective = True ):
418- """
419- Run ``process_deposit``, yielding:
420- - pre-state ('pre')
421- - deposit ('deposit')
422- - post-state ('post').
423- If ``valid == False``, run expecting ``AssertionError``
424- """
425- pre_validator_count = len (state .validators )
426- pre_pending_deposits = len (state .pending_balance_deposits )
427- pre_balance = 0
428- pre_effective_balance = 0
429- is_top_up = False
430- # is a top-up
431- if validator_index < pre_validator_count :
432- is_top_up = True
433- pre_balance = get_balance (state , validator_index )
434- pre_effective_balance = state .validators [validator_index ].effective_balance
435-
436- yield 'pre' , state
437- yield 'deposit' , deposit
438-
439- if not valid :
440- expect_assertion_error (lambda : spec .process_deposit (state , deposit ))
441- yield 'post' , None
442- return
443-
444- spec .process_deposit (state , deposit )
445-
446- yield 'post' , state
447-
448- if not effective or not bls .KeyValidate (deposit .data .pubkey ):
449- assert len (state .validators ) == pre_validator_count
450- assert len (state .balances ) == pre_validator_count
451- else :
452- # no balance changes on deposit processing
453- assert get_balance (state , validator_index ) == pre_balance
454- assert state .validators [validator_index ].effective_balance == pre_effective_balance
455- if is_top_up :
456- assert len (state .validators ) == pre_validator_count
457- assert len (state .balances ) == pre_validator_count
458- else :
459- # new validator
460- assert len (state .validators ) == pre_validator_count + 1
461- assert len (state .balances ) == pre_validator_count + 1
462- # new correct balance deposit has been appended
463- assert len (state .pending_balance_deposits ) == pre_pending_deposits + 1
464- assert state .pending_balance_deposits [pre_pending_deposits ].amount == deposit .data .amount
465- assert state .pending_balance_deposits [pre_pending_deposits ].index == validator_index
466- assert state .eth1_deposit_index == state .eth1_data .deposit_count
467-
468-
469- def run_deposit_processing_eip7251_with_specific_fork_version (
470- spec ,
471- state ,
472- fork_version ,
473- valid = True ,
474- effective = True ):
475- validator_index = len (state .validators )
476- amount = spec .MAX_EFFECTIVE_BALANCE
477-
478- pubkey = pubkeys [validator_index ]
479- privkey = privkeys [validator_index ]
480- withdrawal_credentials = spec .BLS_WITHDRAWAL_PREFIX + spec .hash (pubkey )[1 :]
481-
482- deposit_message = spec .DepositMessage (pubkey = pubkey , withdrawal_credentials = withdrawal_credentials , amount = amount )
483- domain = spec .compute_domain (domain_type = spec .DOMAIN_DEPOSIT , fork_version = fork_version )
484- deposit_data = spec .DepositData (
485- pubkey = pubkey , withdrawal_credentials = withdrawal_credentials , amount = amount ,
486- signature = bls .Sign (privkey , spec .compute_signing_root (deposit_message , domain ))
487- )
488- deposit , root , _ = deposit_from_context (spec , [deposit_data ], 0 )
489-
490- state .eth1_deposit_index = 0
491- state .eth1_data .deposit_root = root
492- state .eth1_data .deposit_count = 1
493-
494- yield from run_deposit_processing_eip7251 (spec , state , deposit , validator_index , valid = valid , effective = effective )
0 commit comments