mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-20 02:08:12 +00:00
Altair (HF1/v1.1.0) minimal and mainnet presets/constants (#2444)
* Altair mainnet & minimal presets * std/math not used
This commit is contained in:
parent
895fe4baf1
commit
dfd99ec943
@ -114,8 +114,8 @@ template maxSize*(n: int) {.pragma.}
|
|||||||
type
|
type
|
||||||
# Domains
|
# Domains
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#domain-types
|
|
||||||
DomainType* = enum
|
DomainType* = enum
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#domain-types
|
||||||
DOMAIN_BEACON_PROPOSER = 0
|
DOMAIN_BEACON_PROPOSER = 0
|
||||||
DOMAIN_BEACON_ATTESTER = 1
|
DOMAIN_BEACON_ATTESTER = 1
|
||||||
DOMAIN_RANDAO = 2
|
DOMAIN_RANDAO = 2
|
||||||
@ -124,6 +124,11 @@ type
|
|||||||
DOMAIN_SELECTION_PROOF = 5
|
DOMAIN_SELECTION_PROOF = 5
|
||||||
DOMAIN_AGGREGATE_AND_PROOF = 6
|
DOMAIN_AGGREGATE_AND_PROOF = 6
|
||||||
|
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L31
|
||||||
|
# Needs to be in same enum definition and is safe regardless of whether one
|
||||||
|
# only accesses phase 0 definitions
|
||||||
|
DOMAIN_SYNC_COMMITTEE = 7
|
||||||
|
|
||||||
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#custom-types
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#custom-types
|
||||||
Domain* = array[32, byte]
|
Domain* = array[32, byte]
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
type
|
type
|
||||||
PresetValue* {.pure.} = enum
|
PresetValue* {.pure.} = enum
|
||||||
|
ALTAIR_FORK_VERSION
|
||||||
BASE_REWARD_FACTOR
|
BASE_REWARD_FACTOR
|
||||||
BLS_WITHDRAWAL_PREFIX
|
BLS_WITHDRAWAL_PREFIX
|
||||||
CHURN_LIMIT_QUOTIENT
|
CHURN_LIMIT_QUOTIENT
|
||||||
@ -12,6 +13,7 @@ type
|
|||||||
DOMAIN_DEPOSIT
|
DOMAIN_DEPOSIT
|
||||||
DOMAIN_RANDAO
|
DOMAIN_RANDAO
|
||||||
DOMAIN_SELECTION_PROOF
|
DOMAIN_SELECTION_PROOF
|
||||||
|
DOMAIN_SYNC_COMMITTEE
|
||||||
DOMAIN_VOLUNTARY_EXIT
|
DOMAIN_VOLUNTARY_EXIT
|
||||||
EFFECTIVE_BALANCE_INCREMENT
|
EFFECTIVE_BALANCE_INCREMENT
|
||||||
EJECTION_BALANCE
|
EJECTION_BALANCE
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -22,6 +22,7 @@ type
|
|||||||
|
|
||||||
RuntimePreset* = object
|
RuntimePreset* = object
|
||||||
GENESIS_FORK_VERSION*: Version
|
GENESIS_FORK_VERSION*: Version
|
||||||
|
ALTAIR_FORK_VERSION*: Version
|
||||||
GENESIS_DELAY*: uint64
|
GENESIS_DELAY*: uint64
|
||||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64
|
||||||
MIN_GENESIS_TIME*: uint64
|
MIN_GENESIS_TIME*: uint64
|
||||||
@ -40,6 +41,7 @@ const
|
|||||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT,
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT,
|
||||||
MIN_GENESIS_TIME,
|
MIN_GENESIS_TIME,
|
||||||
GENESIS_FORK_VERSION,
|
GENESIS_FORK_VERSION,
|
||||||
|
ALTAIR_FORK_VERSION,
|
||||||
GENESIS_DELAY,
|
GENESIS_DELAY,
|
||||||
ETH1_FOLLOW_DISTANCE,
|
ETH1_FOLLOW_DISTANCE,
|
||||||
}
|
}
|
||||||
@ -60,10 +62,12 @@ const
|
|||||||
DOMAIN_VOLUNTARY_EXIT,
|
DOMAIN_VOLUNTARY_EXIT,
|
||||||
DOMAIN_SELECTION_PROOF,
|
DOMAIN_SELECTION_PROOF,
|
||||||
DOMAIN_AGGREGATE_AND_PROOF,
|
DOMAIN_AGGREGATE_AND_PROOF,
|
||||||
|
DOMAIN_SYNC_COMMITTEE,
|
||||||
CONFIG_NAME
|
CONFIG_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
presetValueTypes* = {
|
presetValueTypes* = {
|
||||||
|
ALTAIR_FORK_VERSION: "Version",
|
||||||
BLS_WITHDRAWAL_PREFIX: "byte",
|
BLS_WITHDRAWAL_PREFIX: "byte",
|
||||||
GENESIS_FORK_VERSION: "Version",
|
GENESIS_FORK_VERSION: "Version",
|
||||||
}.toTable
|
}.toTable
|
||||||
@ -133,6 +137,7 @@ const mainnetRuntimePreset* = RuntimePreset(
|
|||||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384,
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384,
|
||||||
MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC
|
MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC
|
||||||
GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 0],
|
GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 0],
|
||||||
|
ALTAIR_FORK_VERSION: Version [byte 1, 0, 0, 0],
|
||||||
GENESIS_DELAY: 604800,
|
GENESIS_DELAY: 604800,
|
||||||
ETH1_FOLLOW_DISTANCE: 2048)
|
ETH1_FOLLOW_DISTANCE: 2048)
|
||||||
|
|
||||||
@ -141,6 +146,7 @@ const
|
|||||||
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64,
|
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64,
|
||||||
MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC
|
MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC
|
||||||
GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 1],
|
GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 1],
|
||||||
|
ALTAIR_FORK_VERSION: Version [byte 1, 0, 0, 0],
|
||||||
GENESIS_DELAY: 300,
|
GENESIS_DELAY: 300,
|
||||||
ETH1_FOLLOW_DISTANCE: 16)
|
ETH1_FOLLOW_DISTANCE: 16)
|
||||||
|
|
||||||
|
50
beacon_chain/spec/presets/altair/mainnet.nim
Normal file
50
beacon_chain/spec/presets/altair/mainnet.nim
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# beacon_chain
|
||||||
|
# Copyright (c) 2021 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * 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).
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
const
|
||||||
|
# Updated penalty values
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L5
|
||||||
|
CONFIG_NAME* = "mainnet"
|
||||||
|
|
||||||
|
INACTIVITY_PENALTY_QUOTIENT_ALTAIR* = 50331648 ##\
|
||||||
|
## 3 * 2**24 (= 50,331,648)
|
||||||
|
|
||||||
|
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR* = 64
|
||||||
|
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR* = 2
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L15
|
||||||
|
SYNC_COMMITTEE_SIZE* = 1024
|
||||||
|
SYNC_SUBCOMMITTEE_SIZE* = 64
|
||||||
|
INACTIVITY_SCORE_BIAS* = 4
|
||||||
|
|
||||||
|
# Time parameters
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L25
|
||||||
|
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* = 256
|
||||||
|
|
||||||
|
# Signature domains (DOMAIN_SYNC_COMMITTEE) in spec/datatypes/base
|
||||||
|
|
||||||
|
# Fork
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L36
|
||||||
|
|
||||||
|
# ALTAIR_FORK_VERSION is a runtime preset
|
||||||
|
|
||||||
|
ALTAIR_FORK_SLOT* = 0 # TBD
|
||||||
|
|
||||||
|
# Sync protocol
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/mainnet/altair.yaml#L43
|
||||||
|
MIN_SYNC_COMMITTEE_PARTICIPANTS* = 1
|
||||||
|
MAX_VALID_LIGHT_CLIENT_UPDATES* = 8192
|
||||||
|
LIGHT_CLIENT_UPDATE_TIMEOUT* = 8192
|
50
beacon_chain/spec/presets/altair/minimal.nim
Normal file
50
beacon_chain/spec/presets/altair/minimal.nim
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# beacon_chain
|
||||||
|
# Copyright (c) 2021 Status Research & Development GmbH
|
||||||
|
# Licensed and distributed under either of
|
||||||
|
# * 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).
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
const
|
||||||
|
# Updated penalty values
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/minimal/altair.yaml#L5
|
||||||
|
CONFIG_NAME* = "minimal"
|
||||||
|
|
||||||
|
INACTIVITY_PENALTY_QUOTIENT_ALTAIR* = 50331648 ##\
|
||||||
|
## 3 * 2**24 (= 50,331,648)
|
||||||
|
|
||||||
|
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR* = 64
|
||||||
|
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR* = 2
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/minimal/altair.yaml#L15
|
||||||
|
SYNC_COMMITTEE_SIZE* = 32
|
||||||
|
SYNC_SUBCOMMITTEE_SIZE* = 16
|
||||||
|
INACTIVITY_SCORE_BIAS* = 4
|
||||||
|
|
||||||
|
# Time parameters
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/minimal/altair.yaml#L25
|
||||||
|
EPOCHS_PER_SYNC_COMMITTEE_PERIOD* = 8
|
||||||
|
|
||||||
|
# Signature domains (DOMAIN_SYNC_COMMITTEE) in spec/datatypes/base
|
||||||
|
|
||||||
|
# Fork
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/minimal/altair.yaml#L36
|
||||||
|
|
||||||
|
# ALTAIR_FORK_VERSION is a runtime preset
|
||||||
|
|
||||||
|
ALTAIR_FORK_SLOT* = 0 # TBD
|
||||||
|
|
||||||
|
# Sync protocol
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.1/configs/minimal/altair.yaml#L43
|
||||||
|
MIN_SYNC_COMMITTEE_PARTICIPANTS* = 1
|
||||||
|
MAX_VALID_LIGHT_CLIENT_UPDATES* = 32
|
||||||
|
LIGHT_CLIENT_UPDATE_TIMEOUT* = 32
|
Loading…
x
Reference in New Issue
Block a user