4141 - [ ` BeaconState ` ] ( #beaconstate )
4242- [ Helper functions] ( #helper-functions )
4343 - [ Predicates] ( #predicates )
44- - [ Updated ` compute_proposer_index ` ] ( #updated -compute_proposer_index )
45- - [ Updated ` is_eligible_for_activation_queue ` ] ( #updated -is_eligible_for_activation_queue )
44+ - [ Modified ` compute_proposer_index ` ] ( #modified -compute_proposer_index )
45+ - [ Modified ` is_eligible_for_activation_queue ` ] ( #modified -is_eligible_for_activation_queue )
4646 - [ New ` is_compounding_withdrawal_credential ` ] ( #new-is_compounding_withdrawal_credential )
4747 - [ New ` has_compounding_withdrawal_credential ` ] ( #new-has_compounding_withdrawal_credential )
4848 - [ New ` has_execution_withdrawal_credential ` ] ( #new-has_execution_withdrawal_credential )
49- - [ Updated ` is_fully_withdrawable_validator ` ] ( #updated -is_fully_withdrawable_validator )
50- - [ Updated ` is_partially_withdrawable_validator ` ] ( #updated -is_partially_withdrawable_validator )
49+ - [ Modified ` is_fully_withdrawable_validator ` ] ( #modified -is_fully_withdrawable_validator )
50+ - [ Modified ` is_partially_withdrawable_validator ` ] ( #modified -is_partially_withdrawable_validator )
5151 - [ Misc] ( #misc-1 )
5252 - [ New ` get_committee_indices ` ] ( #new-get_committee_indices )
5353 - [ New ` get_validator_max_effective_balance ` ] ( #new-get_validator_max_effective_balance )
6060 - [ Modified ` get_attesting_indices ` ] ( #modified-get_attesting_indices )
6161 - [ Modified ` get_next_sync_committee_indices ` ] ( #modified-get_next_sync_committee_indices )
6262 - [ Beacon state mutators] ( #beacon-state-mutators )
63- - [ Updated ` initiate_validator_exit ` ] ( #updated -initiate_validator_exit )
63+ - [ Modified ` initiate_validator_exit ` ] ( #modified -initiate_validator_exit )
6464 - [ New ` switch_to_compounding_validator ` ] ( #new-switch_to_compounding_validator )
6565 - [ New ` queue_excess_active_balance ` ] ( #new-queue_excess_active_balance )
6666 - [ New ` queue_entire_balance_and_reset_validator ` ] ( #new-queue_entire_balance_and_reset_validator )
6767 - [ New ` compute_exit_epoch_and_update_churn ` ] ( #new-compute_exit_epoch_and_update_churn )
6868 - [ New ` compute_consolidation_epoch_and_update_churn ` ] ( #new-compute_consolidation_epoch_and_update_churn )
69- - [ Updated ` slash_validator ` ] ( #updated -slash_validator )
69+ - [ Modified ` slash_validator ` ] ( #modified -slash_validator )
7070- [ Beacon chain state transition function] ( #beacon-chain-state-transition-function )
7171 - [ Epoch processing] ( #epoch-processing )
72- - [ Updated ` process_epoch ` ] ( #updated -process_epoch )
73- - [ Updated ` process_registry_updates ` ] ( #updated -process_registry_updates )
72+ - [ Modified ` process_epoch ` ] ( #modified -process_epoch )
73+ - [ Modified ` process_registry_updates ` ] ( #modified -process_registry_updates )
7474 - [ New ` process_pending_balance_deposits ` ] ( #new-process_pending_balance_deposits )
7575 - [ New ` process_pending_consolidations ` ] ( #new-process_pending_consolidations )
76- - [ Updated ` process_effective_balance_updates ` ] ( #updated -process_effective_balance_updates )
76+ - [ Modified ` process_effective_balance_updates ` ] ( #modified -process_effective_balance_updates )
7777 - [ Block processing] ( #block-processing )
7878 - [ Withdrawals] ( #withdrawals )
79- - [ Updated ` get_expected_withdrawals ` ] ( #updated -get_expected_withdrawals )
80- - [ Updated ` process_withdrawals ` ] ( #updated -process_withdrawals )
79+ - [ Modified ` get_expected_withdrawals ` ] ( #modified -get_expected_withdrawals )
80+ - [ Modified ` process_withdrawals ` ] ( #modified -process_withdrawals )
8181 - [ Execution payload] ( #execution-payload )
8282 - [ Modified ` process_execution_payload ` ] ( #modified-process_execution_payload )
8383 - [ Operations] ( #operations )
8484 - [ Modified ` process_operations ` ] ( #modified-process_operations )
8585 - [ Attestations] ( #attestations )
8686 - [ Modified ` process_attestation ` ] ( #modified-process_attestation )
8787 - [ Deposits] ( #deposits )
88- - [ Updated ` apply_deposit ` ] ( #updated -apply_deposit )
88+ - [ Modified ` apply_deposit ` ] ( #modified -apply_deposit )
8989 - [ New ` is_valid_deposit_signature ` ] ( #new-is_valid_deposit_signature )
9090 - [ Modified ` add_validator_to_registry ` ] ( #modified-add_validator_to_registry )
91- - [ Updated ` get_validator_from_deposit ` ] ( #updated -get_validator_from_deposit )
91+ - [ Modified ` get_validator_from_deposit ` ] ( #modified -get_validator_from_deposit )
9292 - [ Voluntary exits] ( #voluntary-exits )
93- - [ Updated ` process_voluntary_exit ` ] ( #updated -process_voluntary_exit )
93+ - [ Modified ` process_voluntary_exit ` ] ( #modified -process_voluntary_exit )
9494 - [ Execution layer withdrawal requests] ( #execution-layer-withdrawal-requests )
9595 - [ New ` process_withdrawal_request ` ] ( #new-process_withdrawal_request )
9696 - [ Deposit requests] ( #deposit-requests )
@@ -429,9 +429,9 @@ class BeaconState(Container):
429429
430430### Predicates
431431
432- #### Updated ` compute_proposer_index `
432+ #### Modified ` compute_proposer_index `
433433
434- * Note* : The function is modified to use ` MAX_EFFECTIVE_BALANCE_ELECTRA ` preset .
434+ * Note* : The function ` compute_proposer_index ` is modified to use ` MAX_EFFECTIVE_BALANCE_ELECTRA ` .
435435
436436``` python
437437def compute_proposer_index (state : BeaconState, indices : Sequence[ValidatorIndex], seed : Bytes32) -> ValidatorIndex:
@@ -452,7 +452,9 @@ def compute_proposer_index(state: BeaconState, indices: Sequence[ValidatorIndex]
452452 i += 1
453453```
454454
455- #### Updated ` is_eligible_for_activation_queue `
455+ #### Modified ` is_eligible_for_activation_queue `
456+
457+ * Note* : The function ` is_eligible_for_activation_queue ` is modified to use ` MIN_ACTIVATION_BALANCE ` instead of ` MAX_EFFECTIVE_BALANCE ` .
456458
457459``` python
458460def is_eligible_for_activation_queue (validator : Validator) -> bool :
@@ -492,7 +494,9 @@ def has_execution_withdrawal_credential(validator: Validator) -> bool:
492494 return has_compounding_withdrawal_credential(validator) or has_eth1_withdrawal_credential(validator)
493495```
494496
495- #### Updated ` is_fully_withdrawable_validator `
497+ #### Modified ` is_fully_withdrawable_validator `
498+
499+ * Note* : The function ` is_fully_withdrawable_validator ` is modified to use ` has_execution_withdrawal_credential ` instead of ` has_eth1_withdrawal_credential ` .
496500
497501``` python
498502def is_fully_withdrawable_validator (validator : Validator, balance : Gwei, epoch : Epoch) -> bool :
@@ -506,7 +510,9 @@ def is_fully_withdrawable_validator(validator: Validator, balance: Gwei, epoch:
506510 )
507511```
508512
509- #### Updated ` is_partially_withdrawable_validator `
513+ #### Modified ` is_partially_withdrawable_validator `
514+
515+ * Note* : The function ` is_partially_withdrawable_validator ` is modified to use ` get_validator_max_effective_balance ` instead of ` MAX_EFFECTIVE_BALANCE ` and ` has_execution_withdrawal_credential ` instead of ` has_eth1_withdrawal_credential ` .
510516
511517``` python
512518def is_partially_withdrawable_validator (validator : Validator, balance : Gwei) -> bool :
@@ -597,6 +603,8 @@ def get_pending_balance_to_withdraw(state: BeaconState, validator_index: Validat
597603
598604#### Modified ` get_attesting_indices `
599605
606+ * Note* : The function ` get_attesting_indices ` is modified to support EIP7549.
607+
600608``` python
601609def get_attesting_indices (state : BeaconState, attestation : Attestation) -> Set[ValidatorIndex]:
602610 """
@@ -618,7 +626,7 @@ def get_attesting_indices(state: BeaconState, attestation: Attestation) -> Set[V
618626
619627#### Modified ` get_next_sync_committee_indices `
620628
621- * Note* : The function is modified to use ` MAX_EFFECTIVE_BALANCE_ELECTRA ` preset .
629+ * Note* : The function ` get_next_sync_committee_indices ` is modified to use ` MAX_EFFECTIVE_BALANCE_ELECTRA ` .
622630
623631``` python
624632def get_next_sync_committee_indices (state : BeaconState) -> Sequence[ValidatorIndex]:
@@ -645,10 +653,11 @@ def get_next_sync_committee_indices(state: BeaconState) -> Sequence[ValidatorInd
645653 return sync_committee_indices
646654```
647655
648-
649656### Beacon state mutators
650657
651- #### Updated ` initiate_validator_exit `
658+ #### Modified ` initiate_validator_exit `
659+
660+ * Note* : The function ` initiate_validator_exit ` is modified to use the new ` compute_exit_epoch_and_update_churn ` function.
652661
653662``` python
654663def initiate_validator_exit (state : BeaconState, index : ValidatorIndex) -> None :
@@ -692,6 +701,7 @@ def queue_excess_active_balance(state: BeaconState, index: ValidatorIndex) -> No
692701```
693702
694703#### New ` queue_entire_balance_and_reset_validator `
704+
695705``` python
696706def queue_entire_balance_and_reset_validator (state : BeaconState, index : ValidatorIndex) -> None :
697707 balance = state.balances[index]
@@ -757,7 +767,9 @@ def compute_consolidation_epoch_and_update_churn(state: BeaconState, consolidati
757767 return state.earliest_consolidation_epoch
758768```
759769
760- #### Updated ` slash_validator `
770+ #### Modified ` slash_validator `
771+
772+ * Note* : The function ` slash_validator ` is modified to change how the slashing penalty and proposer/whistleblower rewards are calculated in accordance with EIP7251.
761773
762774``` python
763775def slash_validator (state : BeaconState,
@@ -791,7 +803,10 @@ def slash_validator(state: BeaconState,
791803
792804### Epoch processing
793805
794- #### Updated ` process_epoch `
806+ #### Modified ` process_epoch `
807+
808+ * Note* : The function ` process_epoch ` is modified to call updated functions and to process pending balance deposits and pending consolidations which are new in Electra.
809+
795810``` python
796811def process_epoch (state : BeaconState) -> None :
797812 process_justification_and_finalization(state)
@@ -810,9 +825,9 @@ def process_epoch(state: BeaconState) -> None:
810825 process_sync_committee_updates(state)
811826```
812827
813- #### Updated ` process_registry_updates `
828+ #### Modified ` process_registry_updates `
814829
815- ` process_registry_updates ` uses the updated definition of ` initiate_validator_exit `
830+ * Note * : The function ` process_registry_updates ` is modified to use the updated definition of ` initiate_validator_exit `
816831and changes how the activation epochs are computed for eligible validators.
817832
818833``` python
@@ -899,9 +914,9 @@ def process_pending_consolidations(state: BeaconState) -> None:
899914 state.pending_consolidations = state.pending_consolidations[next_pending_consolidation:]
900915```
901916
902- #### Updated ` process_effective_balance_updates `
917+ #### Modified ` process_effective_balance_updates `
903918
904- ` process_effective_balance_updates ` is updated with a new limit for the maximum effective balance.
919+ * Note * : The function ` process_effective_balance_updates ` is modified to use the new limit for the maximum effective balance.
905920
906921``` python
907922def process_effective_balance_updates (state : BeaconState) -> None :
@@ -911,6 +926,7 @@ def process_effective_balance_updates(state: BeaconState) -> None:
911926 HYSTERESIS_INCREMENT = uint64(EFFECTIVE_BALANCE_INCREMENT // HYSTERESIS_QUOTIENT )
912927 DOWNWARD_THRESHOLD = HYSTERESIS_INCREMENT * HYSTERESIS_DOWNWARD_MULTIPLIER
913928 UPWARD_THRESHOLD = HYSTERESIS_INCREMENT * HYSTERESIS_UPWARD_MULTIPLIER
929+ # [Modified in Electra:EIP7251]
914930 EFFECTIVE_BALANCE_LIMIT = (
915931 MAX_EFFECTIVE_BALANCE_ELECTRA if has_compounding_withdrawal_credential(validator)
916932 else MIN_ACTIVATION_BALANCE
@@ -938,7 +954,9 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
938954
939955#### Withdrawals
940956
941- ##### Updated ` get_expected_withdrawals `
957+ ##### Modified ` get_expected_withdrawals `
958+
959+ * Note* : The function ` get_expected_withdrawals ` is modified to support EIP7251.
942960
943961``` python
944962def get_expected_withdrawals (state : BeaconState) -> Tuple[Sequence[Withdrawal], uint64]:
@@ -994,7 +1012,9 @@ def get_expected_withdrawals(state: BeaconState) -> Tuple[Sequence[Withdrawal],
9941012 return withdrawals, partial_withdrawals_count
9951013```
9961014
997- ##### Updated ` process_withdrawals `
1015+ ##### Modified ` process_withdrawals `
1016+
1017+ * Note* : The function ` process_withdrawals ` is modified to support EIP7251.
9981018
9991019``` python
10001020def process_withdrawals (state : BeaconState, payload : ExecutionPayload) -> None :
@@ -1160,9 +1180,9 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
11601180
11611181##### Deposits
11621182
1163- ###### Updated ` apply_deposit `
1183+ ###### Modified ` apply_deposit `
11641184
1165- * NOTE * : ` process_deposit ` is updated with a new definition of ` apply_deposit ` .
1185+ * Note * : The function ` process_deposit ` is modified to support EIP7251 .
11661186
11671187``` python
11681188def apply_deposit (state : BeaconState,
@@ -1180,7 +1200,7 @@ def apply_deposit(state: BeaconState,
11801200 index = ValidatorIndex(validator_pubkeys.index(pubkey))
11811201 state.pending_balance_deposits.append(
11821202 PendingBalanceDeposit(index = index, amount = amount)
1183- ) # [Modified in Electra:EIP-7251 ]
1203+ ) # [Modified in Electra:EIP7251 ]
11841204 # Check if valid deposit switch to compounding credentials
11851205 if (
11861206 is_compounding_withdrawal_credential(withdrawal_credentials)
@@ -1210,6 +1230,8 @@ def is_valid_deposit_signature(pubkey: BLSPubkey,
12101230
12111231###### Modified ` add_validator_to_registry `
12121232
1233+ * Note* : The function ` add_validator_to_registry ` is modified to initialize the validator with a balance of zero and add a pending balance deposit to the queue.
1234+
12131235``` python
12141236def add_validator_to_registry (state : BeaconState,
12151237 pubkey : BLSPubkey,
@@ -1225,7 +1247,9 @@ def add_validator_to_registry(state: BeaconState,
12251247 state.pending_balance_deposits.append(PendingBalanceDeposit(index = index, amount = amount)) # [New in Electra:EIP7251]
12261248```
12271249
1228- ###### Updated ` get_validator_from_deposit `
1250+ ###### Modified ` get_validator_from_deposit `
1251+
1252+ * Note* : The function ` get_validator_from_deposit ` is modified to initialize the validator with an effective balance of zero.
12291253
12301254``` python
12311255def get_validator_from_deposit (pubkey : BLSPubkey, withdrawal_credentials : Bytes32) -> Validator:
@@ -1241,7 +1265,10 @@ def get_validator_from_deposit(pubkey: BLSPubkey, withdrawal_credentials: Bytes3
12411265```
12421266
12431267##### Voluntary exits
1244- ###### Updated ` process_voluntary_exit `
1268+
1269+ ###### Modified ` process_voluntary_exit `
1270+
1271+ * Note* : The function ` process_voluntary_exit ` is modified to ensure the validator has no pending withdrawals in the queue.
12451272
12461273``` python
12471274def process_voluntary_exit (state : BeaconState, signed_voluntary_exit : SignedVoluntaryExit) -> None :
@@ -1269,8 +1296,6 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu
12691296
12701297###### New ` process_withdrawal_request `
12711298
1272- * Note* : This function is new in Electra following EIP-7002 and EIP-7251.
1273-
12741299``` python
12751300def process_withdrawal_request (
12761301 state : BeaconState,
@@ -1338,8 +1363,6 @@ def process_withdrawal_request(
13381363
13391364###### New ` process_deposit_request `
13401365
1341- * Note* : This function is new in Electra: EIP6110 .
1342-
13431366``` python
13441367def process_deposit_request (state : BeaconState, deposit_request : DepositRequest) -> None :
13451368 # Set deposit request start index
0 commit comments