1- Limit churn -- The Beacon Chain
1+ EIP-7668 -- The Beacon Chain
22
33## Table of contents
44
@@ -11,7 +11,7 @@ Limit churn -- The Beacon Chain
1111 - [ Validator cycle] ( #validator-cycle )
1212- [ Helper functions] ( #helper-functions )
1313 - [ Beacon state accessors] ( #beacon-state-accessors )
14- - [ New ` get_validator_inbound_churn_limit ` ] ( #new-get_validator_inbound_churn_limit )
14+ - [ New ` get_validator_activation_churn_limit ` ] ( #new-get_validator_activation_churn_limit )
1515- [ Beacon chain state transition function] ( #beacon-chain-state-transition-function )
1616 - [ Epoch processing] ( #epoch-processing )
1717 - [ Registry updates] ( #registry-updates )
@@ -31,27 +31,20 @@ This is the beacon chain specification to limit the max inbound churn value, mot
3131
3232| Name | Value |
3333| - | - |
34- | ` MAX_PER_EPOCH_INBOUND_CHURN_LIMIT ` | ` uint64(12) ` (= 12) |
34+ | ` MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT ` | ` uint64(12) ` (= 12) |
3535
3636## Helper functions
3737
3838### Beacon state accessors
3939
40- #### New ` get_validator_inbound_churn_limit `
40+ #### New ` get_validator_activation_churn_limit `
4141
4242``` python
43- def get_validator_inbound_churn_limit (state : BeaconState) -> uint64:
43+ def get_validator_activation_churn_limit (state : BeaconState) -> uint64:
4444 """
45- Return the validator inbound churn limit for the current epoch.
45+ Return the validator activation churn limit for the current epoch.
4646 """
47- active_validator_indices = get_active_validator_indices(state, get_current_epoch(state))
48- return min (
49- MAX_PER_EPOCH_INBOUND_CHURN_LIMIT ,
50- max (
51- MIN_PER_EPOCH_CHURN_LIMIT ,
52- uint64(len (active_validator_indices)) // CHURN_LIMIT_QUOTIENT ,
53- ),
54- )
47+ return min (MAX_PER_EPOCH_INBOUND_CHURN_LIMIT , get_validator_churn_limit(state))
5548```
5649
5750## Beacon chain state transition function
@@ -60,6 +53,8 @@ def get_validator_inbound_churn_limit(state: BeaconState) -> uint64:
6053
6154#### Registry updates
6255
56+ Note: The function ` process_registry_updates ` is modified to utilize ` get_validator_inbound_churn_limit() ` the rate limit the activation queue for EIP-7668.
57+
6358``` python
6459def process_registry_updates (state : BeaconState) -> None :
6560 # Process activation eligibility and ejections
@@ -80,8 +75,8 @@ def process_registry_updates(state: BeaconState) -> None:
8075 # Order by the sequence of activation_eligibility_epoch setting and then index
8176 ], key = lambda index : (state.validators[index].activation_eligibility_epoch, index))
8277 # Dequeued validators for activation up to churn limit
83- # [Modified in limit churn ]
84- for index in activation_queue[:get_validator_inbound_churn_limit (state)]:
78+ # [Modified in EIP7668 ]
79+ for index in activation_queue[:get_validator_activation_churn_limit (state)]:
8580 validator = state.validators[index]
8681 validator.activation_epoch = compute_activation_exit_epoch(get_current_epoch(state))
8782```
0 commit comments