2019-05-27 12:48:13 +00:00
|
|
|
# beacon_chain
|
2020-01-27 11:36:17 +00:00
|
|
|
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
2019-05-27 12:48:13 +00:00
|
|
|
# Licensed and distributed under either of
|
2019-11-25 15:30:02 +00:00
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
2019-05-27 12:48:13 +00:00
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
|
|
|
# This file contains constants that are part of the spec and thus subject to
|
|
|
|
# serialization and spec updates.
|
|
|
|
|
|
|
|
import
|
2019-10-25 10:59:56 +00:00
|
|
|
math
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
{.experimental: "codeReordering".} # SLOTS_PER_EPOCH is use before being defined in spec
|
|
|
|
|
|
|
|
const
|
|
|
|
# Misc
|
|
|
|
# ---------------------------------------------------------------
|
2020-06-18 08:16:05 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L4
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2019-11-08 11:31:48 +00:00
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
MAX_COMMITTEES_PER_SLOT*: uint64 = 4
|
|
|
|
TARGET_COMMITTEE_SIZE*: uint64 = 4
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MAX_VALIDATORS_PER_COMMITTEE*: uint64 = 2048
|
|
|
|
MIN_PER_EPOCH_CHURN_LIMIT*: uint64 = 4
|
|
|
|
CHURN_LIMIT_QUOTIENT*: uint64 = 2'u64 ^ 16
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
SHUFFLE_ROUND_COUNT*: uint64 = 10
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2020-03-14 21:54:45 +00:00
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
HYSTERESIS_QUOTIENT*: uint64 = 4
|
|
|
|
HYSTERESIS_DOWNWARD_MULTIPLIER*: uint64 = 1
|
|
|
|
HYSTERESIS_UPWARD_MULTIPLIER*: uint64 = 5
|
2020-03-14 21:54:45 +00:00
|
|
|
|
2019-05-27 12:48:13 +00:00
|
|
|
# Gwei values
|
|
|
|
# ---------------------------------------------------------------
|
2020-06-17 08:25:07 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L58
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MIN_DEPOSIT_AMOUNT*: uint64 = 2'u64^0 * 10'u64^9
|
|
|
|
MAX_EFFECTIVE_BALANCE*: uint64 = 2'u64^5 * 10'u64^9
|
|
|
|
EJECTION_BALANCE*: uint64 = 2'u64^4 * 10'u64^9
|
|
|
|
EFFECTIVE_BALANCE_INCREMENT*: uint64 = 2'u64^0 * 10'u64^9
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Initial values
|
|
|
|
# ---------------------------------------------------------------
|
2020-07-28 14:55:46 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L73
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2020-07-13 14:44:58 +00:00
|
|
|
BLS_WITHDRAWAL_PREFIX*: byte = 0
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Time parameters
|
|
|
|
# ---------------------------------------------------------------
|
2020-06-17 08:25:07 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L77
|
2020-01-14 17:46:58 +00:00
|
|
|
# Changed: Faster to spin up testnets, but does not give validator
|
|
|
|
# reasonable warning time for genesis
|
|
|
|
|
2019-05-27 12:48:13 +00:00
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
SECONDS_PER_SLOT*{.intdefine.}: uint64 = 6
|
0.6.2 updates (#275)
* update process_justification_and_finalization to 0.6.2; mark AttesterSlashing as 0.6.2
* replace get_effective_balance(...) with state.validator_registry[idx].effective_balance; rm get_effective_balance, process_ejections, should_update_validator_registry, update_validator_registry, and update_registry_and_shuffling_data; update get_total_balance to 0.6.2; implement process_registry_updates
* rm exit_validator; implement is_slashable_attestation_data; partly update processAttesterSlashings
* mark HistoricalBatch and Eth1Data as 0.6.2; implement get_shard_delta(...); replace 0.5 finish_epoch_update with 0.6 process_final_updates
* mark increase_balance, decrease_balance, get_delayed_activation_exit_epoch, bls_aggregate_pubkeys, bls_verify_multiple, Attestation, Transfer, slot_to_epoch, Crosslink, get_current_epoch, int_to_bytes*, various constants, processEth1Data, processTransfers, and verifyStateRoot as 0.6.2; rm is_double_vote and is_surround_vote
* mark get_bitfield_bit, verify_bitfield, ProposerSlashing, DepositData, VoluntaryExit, PendingAttestation, Fork, integer_squareroot, get_epoch_start_slot, is_active_validator, generate_seed, some constants to 0.6.2; rename MIN_PENALTY_QUOTIENT to MIN_SLASHING_PENALTY_QUOTIENT
* rm get_previous_total_balance, get_current_epoch_boundary_attestations, get_previous_epoch_boundary_attestations, and get_previous_epoch_matching_head_attestations
* update BeaconState to 0.6.2; simplify legacy get_crosslink_committees_at_slot infrastructure a bit by noting that registry_change is always false; reimplment 0.5 get_crosslink_committees_at_slot in terms of 0.6 get_crosslink_committee
* mark process_deposit(...), get_block_root_at_slot(...), get_block_root(...), Deposit, BeaconBlockHeader, BeaconBlockBody, hash(...), get_active_index_root(...), various constants, get_shard_delta(...), get_epoch_start_shard(...), get_crosslink_committee(...), processRandao(...), processVoluntaryExits(...), cacheState(...) as 0.6.2
* rm removed-since-0.5 split(...), is_power_of_2(...), get_shuffling(...); rm 0.5 versions of get_active_validator_indices and get_epoch_committee_count; add a few tests for integer_squareroot
* mark bytes_to_int(...) and advanceState(...) as 0.6.2
* rm 0.5 get_attesting_indices; update get_attesting_balance to 0.6.2
* another tiny commit to poke AppVeyor to maybe not timeout at connecting to GitHub partway through CI: mark get_churn_limit(...), initiate_validator_exit(...), and Validator as 0.6.2
* mark get_attestation_slot(...), AttestationDataAndCustodyBit, and BeaconBlock as 0.6.2
2019-06-03 10:31:04 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MIN_ATTESTATION_INCLUSION_DELAY*: uint64 = 1
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
SLOTS_PER_EPOCH* {.intdefine.}: uint64 = 8
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MIN_SEED_LOOKAHEAD*: uint64 = 1
|
|
|
|
MAX_SEED_LOOKAHEAD*: uint64 = 4
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
EPOCHS_PER_ETH1_VOTING_PERIOD*: uint64 = 4
|
|
|
|
SLOTS_PER_HISTORICAL_ROOT*: uint64 = 64
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MIN_VALIDATOR_WITHDRAWABILITY_DELAY*: uint64 = 2'u64^8
|
2020-03-14 21:54:45 +00:00
|
|
|
|
2020-07-13 14:44:58 +00:00
|
|
|
SHARD_COMMITTEE_PERIOD*: uint64 = 64 # epochs
|
2020-06-17 08:25:07 +00:00
|
|
|
|
2020-03-14 21:54:45 +00:00
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
MAX_EPOCHS_PER_CROSSLINK*: uint64 = 4
|
2019-11-22 12:08:07 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
MIN_EPOCHS_TO_INACTIVITY_PENALTY*: uint64 = 2'u64^2
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2019-09-05 19:52:34 +00:00
|
|
|
# State vector lengths
|
2019-05-27 12:48:13 +00:00
|
|
|
# ---------------------------------------------------------------
|
2020-07-28 14:55:46 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L108
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 64
|
|
|
|
EPOCHS_PER_SLASHINGS_VECTOR*: uint64 = 64
|
2020-04-10 14:06:24 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
HISTORICAL_ROOTS_LIMIT*: uint64 = 16777216
|
|
|
|
VALIDATOR_REGISTRY_LIMIT*: uint64 = 1099511627776'u64
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Reward and penalty quotients
|
|
|
|
# ---------------------------------------------------------------
|
2020-07-28 14:55:46 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L120
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2020-07-13 14:44:58 +00:00
|
|
|
BASE_REWARD_FACTOR*: uint64 = 2'u64^6
|
|
|
|
WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9
|
|
|
|
PROPOSER_REWARD_QUOTIENT*: uint64 = 2'u64^3
|
|
|
|
INACTIVITY_PENALTY_QUOTIENT*: uint64 = 2'u64^24
|
|
|
|
MIN_SLASHING_PENALTY_QUOTIENT*: uint64 = 32 # 2^5
|
2019-05-27 12:48:13 +00:00
|
|
|
|
|
|
|
# Max operations per block
|
|
|
|
# ---------------------------------------------------------------
|
2020-07-28 14:55:46 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L134
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2020-07-13 14:44:58 +00:00
|
|
|
MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4
|
|
|
|
MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1
|
|
|
|
MAX_ATTESTATIONS*: uint64 = 2'u64 ^ 7
|
|
|
|
MAX_DEPOSITS*: uint64 = 2'u64 ^ 4
|
|
|
|
MAX_VOLUNTARY_EXITS*: uint64 = 2'u64 ^ 4
|
2019-05-27 12:48:13 +00:00
|
|
|
|
2020-07-27 10:59:57 +00:00
|
|
|
# Deposit contract
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L52
|
|
|
|
|
|
|
|
# Ethereum Goerli testnet
|
|
|
|
DEPOSIT_CHAIN_ID* = 5
|
|
|
|
DEPOSIT_NETWORK_ID* = 5
|
|
|
|
|
2019-11-22 19:56:39 +00:00
|
|
|
# Fork choice
|
|
|
|
# ---------------------------------------------------------------
|
2020-07-28 14:55:46 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L32
|
2019-07-12 14:24:11 +00:00
|
|
|
|
2019-11-22 19:56:39 +00:00
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 2
|
2019-11-22 19:56:39 +00:00
|
|
|
|
|
|
|
# Validators
|
|
|
|
# ---------------------------------------------------------------
|
2020-06-17 11:59:02 +00:00
|
|
|
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L38
|
2019-11-22 19:56:39 +00:00
|
|
|
|
|
|
|
# Changed
|
2020-07-13 14:44:58 +00:00
|
|
|
ETH1_FOLLOW_DISTANCE* {.intdefine.}: uint64 = 16 # blocks
|
2019-11-22 19:56:39 +00:00
|
|
|
|
|
|
|
# Unchanged
|
2020-07-13 14:44:58 +00:00
|
|
|
TARGET_AGGREGATORS_PER_COMMITTEE*: uint64 = 16 # validators
|
|
|
|
RANDOM_SUBNETS_PER_VALIDATOR*: uint64 = 1 # subnet
|
|
|
|
EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION*: uint64 = 256 # epochs ~ 27 hours
|
|
|
|
SECONDS_PER_ETH1_BLOCK* {.intdefine.}: uint64 = 14 # estimate from Eth1 mainnet)
|