clean up list limit constants
This commit is contained in:
parent
1408a1ee0d
commit
82ae180490
|
@ -77,6 +77,10 @@ MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4
|
||||||
EPOCHS_PER_HISTORICAL_VECTOR: 65536
|
EPOCHS_PER_HISTORICAL_VECTOR: 65536
|
||||||
# 2**13 (= 8,192) epochs ~36 days
|
# 2**13 (= 8,192) epochs ~36 days
|
||||||
EPOCHS_PER_SLASHED_BALANCES_VECTOR: 8192
|
EPOCHS_PER_SLASHED_BALANCES_VECTOR: 8192
|
||||||
|
# 2**24 (= 16,777,216) historical roots, ~26,131 years
|
||||||
|
HISTORICAL_ROOTS_LIMIT: 16777216
|
||||||
|
# 2**40 (= 1,099,511,627,776) validator spots
|
||||||
|
VALIDATOR_REGISTRY_LIMIT: 1099511627776
|
||||||
|
|
||||||
|
|
||||||
# Reward and penalty quotients
|
# Reward and penalty quotients
|
||||||
|
|
|
@ -78,6 +78,10 @@ EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS: 4096
|
||||||
EPOCHS_PER_HISTORICAL_VECTOR: 64
|
EPOCHS_PER_HISTORICAL_VECTOR: 64
|
||||||
# [customized] smaller state
|
# [customized] smaller state
|
||||||
EPOCHS_PER_SLASHED_BALANCES_VECTOR: 64
|
EPOCHS_PER_SLASHED_BALANCES_VECTOR: 64
|
||||||
|
# 2**24 (= 16,777,216) historical roots
|
||||||
|
HISTORICAL_ROOTS_LIMIT: 16777216
|
||||||
|
# 2**40 (= 1,099,511,627,776) validator spots
|
||||||
|
VALIDATOR_REGISTRY_LIMIT: 1099511627776
|
||||||
|
|
||||||
|
|
||||||
# Reward and penalty quotients
|
# Reward and penalty quotients
|
||||||
|
|
|
@ -224,7 +224,6 @@ These configurations are updated for releases, but may be out of sync during `de
|
||||||
| `ACTIVATION_EXIT_DELAY` | `2**2` (= 4) | epochs | 25.6 minutes |
|
| `ACTIVATION_EXIT_DELAY` | `2**2` (= 4) | epochs | 25.6 minutes |
|
||||||
| `SLOTS_PER_ETH1_VOTING_PERIOD` | `2**10` (= 1,024) | slots | ~1.7 hours |
|
| `SLOTS_PER_ETH1_VOTING_PERIOD` | `2**10` (= 1,024) | slots | ~1.7 hours |
|
||||||
| `SLOTS_PER_HISTORICAL_ROOT` | `2**13` (= 8,192) | slots | ~13 hours |
|
| `SLOTS_PER_HISTORICAL_ROOT` | `2**13` (= 8,192) | slots | ~13 hours |
|
||||||
| `HISTORICAL_ROOTS_LENGTH` | `2**24` (= 16,777,216) | historical roots | ~26,131 years |
|
|
||||||
| `MIN_VALIDATOR_WITHDRAWABILITY_DELAY` | `2**8` (= 256) | epochs | ~27 hours |
|
| `MIN_VALIDATOR_WITHDRAWABILITY_DELAY` | `2**8` (= 256) | epochs | ~27 hours |
|
||||||
| `PERSISTENT_COMMITTEE_PERIOD` | `2**11` (= 2,048) | epochs | 9 days |
|
| `PERSISTENT_COMMITTEE_PERIOD` | `2**11` (= 2,048) | epochs | 9 days |
|
||||||
| `MAX_EPOCHS_PER_CROSSLINK` | `2**6` (= 64) | epochs | ~7 hours |
|
| `MAX_EPOCHS_PER_CROSSLINK` | `2**6` (= 64) | epochs | ~7 hours |
|
||||||
|
@ -238,10 +237,8 @@ These configurations are updated for releases, but may be out of sync during `de
|
||||||
| - | - | :-: | :-: |
|
| - | - | :-: | :-: |
|
||||||
| `EPOCHS_PER_HISTORICAL_VECTOR` | `2**16` (= 65,536) | epochs | ~0.8 years |
|
| `EPOCHS_PER_HISTORICAL_VECTOR` | `2**16` (= 65,536) | epochs | ~0.8 years |
|
||||||
| `EPOCHS_PER_SLASHED_BALANCES_VECTOR` | `2**13` (= 8,192) | epochs | ~36 days |
|
| `EPOCHS_PER_SLASHED_BALANCES_VECTOR` | `2**13` (= 8,192) | epochs | ~36 days |
|
||||||
| `RANDAO_MIXES_LENGTH` | `2**13` (= 8,192) | epochs | ~36 days |
|
| `HISTORICAL_ROOTS_LIMIT` | `2**24` (= 16,777,216) | historical roots | ~26,131 years |
|
||||||
| `ACTIVE_INDEX_ROOTS_LENGTH` | `2**13` (= 8,192) | epochs | ~36 days |
|
| `VALIDATOR_REGISTRY_LIMIT` | `2**40` (= 1,099,511,627,776) | validator spots | |
|
||||||
| `SLASHED_EXIT_LENGTH` | `2**13` (= 8,192) | epochs | ~36 days |
|
|
||||||
| `VALIDATOR_REGISTRY_SIZE` | `2**40` (= 1,099,511,627,776) | | |
|
|
||||||
|
|
||||||
### Rewards and penalties
|
### Rewards and penalties
|
||||||
|
|
||||||
|
@ -520,14 +517,14 @@ class BeaconState(Container):
|
||||||
latest_block_header: BeaconBlockHeader
|
latest_block_header: BeaconBlockHeader
|
||||||
block_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
|
block_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
|
||||||
state_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
|
state_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
|
||||||
historical_roots: List[Hash, HISTORICAL_ROOTS_LENGTH]
|
historical_roots: List[Hash, HISTORICAL_ROOTS_LIMIT]
|
||||||
# Eth1
|
# Eth1
|
||||||
eth1_data: Eth1Data
|
eth1_data: Eth1Data
|
||||||
eth1_data_votes: List[Eth1Data, SLOTS_PER_ETH1_VOTING_PERIOD]
|
eth1_data_votes: List[Eth1Data, SLOTS_PER_ETH1_VOTING_PERIOD]
|
||||||
eth1_deposit_index: uint64
|
eth1_deposit_index: uint64
|
||||||
# Registry
|
# Registry
|
||||||
validators: List[Validator, VALIDATOR_REGISTRY_SIZE]
|
validators: List[Validator, VALIDATOR_REGISTRY_LIMIT]
|
||||||
balances: List[Gwei, VALIDATOR_REGISTRY_SIZE]
|
balances: List[Gwei, VALIDATOR_REGISTRY_LIMIT]
|
||||||
# Shuffling
|
# Shuffling
|
||||||
start_shard: Shard
|
start_shard: Shard
|
||||||
randao_mixes: Vector[Hash, EPOCHS_PER_HISTORICAL_VECTOR]
|
randao_mixes: Vector[Hash, EPOCHS_PER_HISTORICAL_VECTOR]
|
||||||
|
@ -1195,7 +1192,7 @@ def get_genesis_beacon_state(deposits: Sequence[Deposit], genesis_time: int, eth
|
||||||
|
|
||||||
# Populate active_index_roots
|
# Populate active_index_roots
|
||||||
genesis_active_index_root = hash_tree_root(
|
genesis_active_index_root = hash_tree_root(
|
||||||
List[ValidatorIndex, VALIDATOR_REGISTRY_SIZE](get_active_validator_indices(state, GENESIS_EPOCH))
|
List[ValidatorIndex, VALIDATOR_REGISTRY_LIMIT](get_active_validator_indices(state, GENESIS_EPOCH))
|
||||||
)
|
)
|
||||||
for index in range(EPOCHS_PER_HISTORICAL_VECTOR):
|
for index in range(EPOCHS_PER_HISTORICAL_VECTOR):
|
||||||
state.active_index_roots[index] = genesis_active_index_root
|
state.active_index_roots[index] = genesis_active_index_root
|
||||||
|
@ -1553,7 +1550,7 @@ def process_final_updates(state: BeaconState) -> None:
|
||||||
# Set active index root
|
# Set active index root
|
||||||
index_root_position = (next_epoch + ACTIVATION_EXIT_DELAY) % EPOCHS_PER_HISTORICAL_VECTOR
|
index_root_position = (next_epoch + ACTIVATION_EXIT_DELAY) % EPOCHS_PER_HISTORICAL_VECTOR
|
||||||
state.active_index_roots[index_root_position] = hash_tree_root(
|
state.active_index_roots[index_root_position] = hash_tree_root(
|
||||||
List[ValidatorIndex, VALIDATOR_REGISTRY_SIZE](
|
List[ValidatorIndex, VALIDATOR_REGISTRY_LIMIT](
|
||||||
get_active_validator_indices(state, Epoch(next_epoch + ACTIVATION_EXIT_DELAY))
|
get_active_validator_indices(state, Epoch(next_epoch + ACTIVATION_EXIT_DELAY))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -41,7 +41,7 @@ def create_genesis_state(spec, num_validators):
|
||||||
validator.activation_eligibility_epoch = spec.GENESIS_EPOCH
|
validator.activation_eligibility_epoch = spec.GENESIS_EPOCH
|
||||||
validator.activation_epoch = spec.GENESIS_EPOCH
|
validator.activation_epoch = spec.GENESIS_EPOCH
|
||||||
|
|
||||||
genesis_active_index_root = hash_tree_root(List[spec.ValidatorIndex, spec.VALIDATOR_REGISTRY_SIZE](
|
genesis_active_index_root = hash_tree_root(List[spec.ValidatorIndex, spec.VALIDATOR_REGISTRY_LIMIT](
|
||||||
spec.get_active_validator_indices(state, spec.GENESIS_EPOCH)))
|
spec.get_active_validator_indices(state, spec.GENESIS_EPOCH)))
|
||||||
for index in range(spec.EPOCHS_PER_HISTORICAL_VECTOR):
|
for index in range(spec.EPOCHS_PER_HISTORICAL_VECTOR):
|
||||||
state.active_index_roots[index] = genesis_active_index_root
|
state.active_index_roots[index] = genesis_active_index_root
|
||||||
|
|
Loading…
Reference in New Issue