From e4593d2d0c82c1e46cf103aee83d9b405be8a63c Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 6 May 2021 19:49:33 +0200 Subject: [PATCH] update with configs<>presets separation --- configs/README.md | 43 +++++++---- configs/mainnet/altair.yaml | 53 -------------- configs/mainnet/merge.yaml | 7 -- configs/mainnet_config.yaml | 73 +++++++++++++++++++ configs/mainnet_preset/altair.yaml | 24 ++++++ .../custody_game.yaml | 15 +--- configs/mainnet_preset/merge.yaml | 3 + .../{mainnet => mainnet_preset}/phase0.yaml | 63 +--------------- .../{mainnet => mainnet_preset}/sharding.yaml | 12 --- configs/minimal/altair.yaml | 54 -------------- configs/minimal/merge.yaml | 7 -- configs/minimal_config.yaml | 73 +++++++++++++++++++ configs/minimal_preset/altair.yaml | 24 ++++++ .../custody_game.yaml | 15 +--- configs/minimal_preset/merge.yaml | 3 + .../{minimal => minimal_preset}/phase0.yaml | 62 +--------------- .../{minimal => minimal_preset}/sharding.yaml | 12 --- specs/altair/beacon-chain.md | 6 +- specs/custody_game/beacon-chain.md | 6 ++ specs/phase0/beacon-chain.md | 16 ++-- specs/phase0/fork-choice.md | 4 +- 21 files changed, 257 insertions(+), 318 deletions(-) delete mode 100644 configs/mainnet/altair.yaml delete mode 100644 configs/mainnet/merge.yaml create mode 100644 configs/mainnet_config.yaml create mode 100644 configs/mainnet_preset/altair.yaml rename configs/{mainnet => mainnet_preset}/custody_game.yaml (66%) create mode 100644 configs/mainnet_preset/merge.yaml rename configs/{mainnet => mainnet_preset}/phase0.yaml (60%) rename configs/{mainnet => mainnet_preset}/sharding.yaml (65%) delete mode 100644 configs/minimal/altair.yaml delete mode 100644 configs/minimal/merge.yaml create mode 100644 configs/minimal_config.yaml create mode 100644 configs/minimal_preset/altair.yaml rename configs/{minimal => minimal_preset}/custody_game.yaml (64%) create mode 100644 configs/minimal_preset/merge.yaml rename configs/{minimal => minimal_preset}/phase0.yaml (59%) rename configs/{minimal => minimal_preset}/sharding.yaml (67%) diff --git a/configs/README.md b/configs/README.md index 2cf4e3f60..031fc215e 100644 --- a/configs/README.md +++ b/configs/README.md @@ -1,34 +1,49 @@ -# Configs +# Presets & Configurations -This directory contains a set of constants presets used for testing, testnets, and mainnet. +This directory contains a set of presets and configurations used for testing, testnets, and mainnet. -A preset file contains all the constants known for its target. -Later-fork constants can be ignored, e.g. ignore Sharding constants as a client that only supports Phase 0 currently. +**Presets** are for deeper customization for different modes of operation, compile-time changes. +**Configurations** are intended for different network configurations, fully runtime-configurable. + +Later-fork variables can be ignored, e.g. ignore Sharding variables as a client that only supports Phase 0 currently. ## Forking -Configs are not replaced, but extended with forks. This is to support syncing from one state to the other over a fork boundary, without hot-swapping a config. -Instead, for forks that introduce changes in a constant, the constant name is prefixed with a short abbreviation of the fork. +Variables are not replaced, but extended with forks. This is to support syncing from one state to the other over a fork boundary, without hot-swapping a config. +Instead, for forks that introduce changes in a variable, the variable name is prefixed with a short abbreviation of the fork. Over time, the need to sync an older state may be deprecated. -In this case, the prefix on the new constant may be removed, and the old constant will keep a special name before completely being removed. +In this case, the prefix on the new variable may be removed, and the old variable will keep a special name before completely being removed. -A previous iteration of forking made use of "timelines", but this collides with the definitions used in the spec (constants for special forking slots, etc.), and was not integrated sufficiently in any of the spec tools or implementations. +A previous iteration of forking made use of "timelines", but this collides with the definitions used in the spec (variables for special forking slots, etc.), and was not integrated sufficiently in any of the spec tools or implementations. Instead, the config essentially doubles as fork definition now, e.g. changing the value for `ALTAIR_FORK_EPOCH` changes the fork. - -Another reason to prefer forking through constants is the ability to program a forking moment based on context, instead of being limited to a static slot number. ## Format -Each preset is a key-value mapping. +Each preset and configuration is a key-value mapping. -**Key**: an `UPPER_SNAKE_CASE` (a.k.a. "macro case") formatted string, name of the constant. +**Key**: an `UPPER_SNAKE_CASE` (a.k.a. "macro case") formatted string, name of the variable. **Value** can be either: - an unsigned integer number, can be up to 64 bits (incl.) - a hexadecimal string, prefixed with `0x` -Presets may contain comments to describe the values. +This format is fully YAML compatible. +The presets and configurations may contain comments to describe the values. -See [`mainnet/phase0.yaml`](./mainnet/phase0.yaml) for a complete example. +## Presets + +Presets are more extensive than runtime configurations, and generally only applicable during compile-time. +Each preset is defined as a directory, with YAML files per fork. +Configurations can extend a preset by setting the `PRESET_BASE` variable. +An implementation may choose to only support 1 preset per build-target and should validate this `PRESET_BASE` variable. + +See: [`mainnet_preset/`](./mainnet_preset) and [`minimal_preset/`](./minimal_preset). + +## Configuration + +Configurations are more minimal, singular YAML files, to define different network definitions. +Besides different (test-)network definitions, implementations also apply these during runtime for spec-tests. + +See: [`mainnet_config.yaml`](./mainnet_config.yaml) and [`minimal_config.yaml`](./minimal_config.yaml). diff --git a/configs/mainnet/altair.yaml b/configs/mainnet/altair.yaml deleted file mode 100644 index a6761b142..000000000 --- a/configs/mainnet/altair.yaml +++ /dev/null @@ -1,53 +0,0 @@ -# Mainnet preset - Altair - -# Updated penalty values -# --------------------------------------------------------------- -# 3 * 2**24 (= 50,331,648) -INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 -# 2**6 (= 64) -MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 -# 2 -PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 - - -# Sync committee -# --------------------------------------------------------------- -# 2**9 (= 512) -SYNC_COMMITTEE_SIZE: 512 -# 2**9 (= 512) -EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 512 - - -# Misc -# --------------------------------------------------------------- -# 2**2 (= 4) -INACTIVITY_SCORE_BIAS: 4 -# 2**4 (= 16) -INACTIVITY_SCORE_RECOVERY_RATE: 16 - - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_SYNC_COMMITTEE: 0x07000000 -DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF: 0x08000000 -DOMAIN_CONTRIBUTION_AND_PROOF: 0x09000000 - - -# Fork -# --------------------------------------------------------------- -# 0x01000000 -ALTAIR_FORK_VERSION: 0x01000000 -# TBD -ALTAIR_FORK_EPOCH: 18446744073709551615 - - -# Sync protocol -# --------------------------------------------------------------- -# 1 -MIN_SYNC_COMMITTEE_PARTICIPANTS: 1 - - -# Validator -# --------------------------------------------------------------- -# 2**2 (= 4) -TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 4 diff --git a/configs/mainnet/merge.yaml b/configs/mainnet/merge.yaml deleted file mode 100644 index 4e012ac05..000000000 --- a/configs/mainnet/merge.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Mainnet preset - The Merge - -# Fork -# --------------------------------------------------------------- -MERGE_FORK_VERSION: 0x02000000 -# TBD, temporarily max uint64 value: 2**64 - 1 -MERGE_FORK_EPOCH: 18446744073709551615 diff --git a/configs/mainnet_config.yaml b/configs/mainnet_config.yaml new file mode 100644 index 000000000..778709d98 --- /dev/null +++ b/configs/mainnet_config.yaml @@ -0,0 +1,73 @@ +# Mainnet config + +# Extends the mainnet preset +PRESET_BASE: 'mainnet' + +# Genesis +# --------------------------------------------------------------- +# `2**14` (= 16,384) +MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384 +# Dec 1, 2020, 12pm UTC +MIN_GENESIS_TIME: 1606824000 +# Mainnet initial fork version, recommend altering for testnets +GENESIS_FORK_VERSION: 0x00000000 +# 604800 seconds (7 days) +GENESIS_DELAY: 604800 + + +# Forking +# --------------------------------------------------------------- +# Some forks are disabled for now: +# - They may be re-assigned another fork-version later +# - They set a temporarily max uint64 value: 2**64 - 1 + +# Altair +ALTAIR_FORK_VERSION: 0x01000000 +ALTAIR_FORK_EPOCH: 18446744073709551615 +# Merge +MERGE_FORK_VERSION: 0x02000000 +MERGE_FORK_EPOCH: 18446744073709551615 +# Sharding +SHARDING_FORK_VERSION: 0x03000000 +SHARDING_FORK_EPOCH: 18446744073709551615 + +# TBD, ignore if 0. Merge transition approach is in active R&D. +TRANSITION_TOTAL_DIFFICULTY: 0 + + +# Time parameters +# --------------------------------------------------------------- +# 12 seconds +SECONDS_PER_SLOT: 12 +# 14 (estimate from Eth1 mainnet) +SECONDS_PER_ETH1_BLOCK: 14 +# 2**8 (= 256) epochs ~27 hours +MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 +# 2**8 (= 256) epochs ~27 hours +SHARD_COMMITTEE_PERIOD: 256 +# 2**11 (= 2,048) Eth1 blocks ~8 hours +ETH1_FOLLOW_DISTANCE: 2048 + + +# Inactivity penalties +# --------------------------------------------------------------- +# 2**2 (= 4) +INACTIVITY_SCORE_BIAS: 4 +# 2**4 (= 16) +INACTIVITY_SCORE_RECOVERY_RATE: 16 + + +# Validator Churn +# --------------------------------------------------------------- +# 2**2 (= 4) +MIN_PER_EPOCH_CHURN_LIMIT: 4 +# 2**16 (= 65,536) +CHURN_LIMIT_QUOTIENT: 65536 + + +# Deposit contract +# --------------------------------------------------------------- +# Ethereum PoW Mainnet +DEPOSIT_CHAIN_ID: 1 +DEPOSIT_NETWORK_ID: 1 +DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cBB839Cbe05303d7705Fa diff --git a/configs/mainnet_preset/altair.yaml b/configs/mainnet_preset/altair.yaml new file mode 100644 index 000000000..9f0ad9b4c --- /dev/null +++ b/configs/mainnet_preset/altair.yaml @@ -0,0 +1,24 @@ +# Mainnet preset - Altair + +# Updated penalty values +# --------------------------------------------------------------- +# 3 * 2**24 (= 50,331,648) +INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 +# 2**6 (= 64) +MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 +# 2 +PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 + + +# Sync committee +# --------------------------------------------------------------- +# 2**9 (= 512) +SYNC_COMMITTEE_SIZE: 512 +# 2**9 (= 512) +EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 512 + + +# Sync protocol +# --------------------------------------------------------------- +# 1 +MIN_SYNC_COMMITTEE_PARTICIPANTS: 1 diff --git a/configs/mainnet/custody_game.yaml b/configs/mainnet_preset/custody_game.yaml similarity index 66% rename from configs/mainnet/custody_game.yaml rename to configs/mainnet_preset/custody_game.yaml index ecb2dc377..2930f9c78 100644 --- a/configs/mainnet/custody_game.yaml +++ b/configs/mainnet_preset/custody_game.yaml @@ -13,14 +13,6 @@ CUSTODY_PERIOD_TO_RANDAO_PADDING: 2048 # 2**15 (= 32,768) epochs, ~146 days MAX_CHUNK_CHALLENGE_DELAY: 32768 -# Misc parameters -# --------------------------------------------------------------- -# 2**256 - 189 -CUSTODY_PRIME: 115792089237316195423570985008687907853269984665640564039457584007913129639747 -# 3 -CUSTODY_SECRETS: 3 -# 1/1024 chance of custody bit 1 -CUSTODY_PROBABILITY_EXPONENT: 10 # Max operations # --------------------------------------------------------------- @@ -35,14 +27,9 @@ MAX_CUSTODY_CHUNK_CHALLENGE_RESP: 16 # 2**0 (= 1) MAX_CUSTODY_SLASHINGS: 1 + # Reward and penalty quotients # --------------------------------------------------------------- EARLY_DERIVED_SECRET_REVEAL_SLOT_REWARD_MULTIPLE: 2 # 2**8 (= 256) MINOR_REWARD_QUOTIENT: 256 - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_CUSTODY_BIT_SLASHING: 0x83000000 -DOMAIN_LIGHT_SELECTION_PROOF: 0x84000000 -DOMAIN_LIGHT_AGGREGATE_AND_PROOF: 0x85000000 diff --git a/configs/mainnet_preset/merge.yaml b/configs/mainnet_preset/merge.yaml new file mode 100644 index 000000000..97f07c7f0 --- /dev/null +++ b/configs/mainnet_preset/merge.yaml @@ -0,0 +1,3 @@ +# Mainnet preset - The Merge + +# No presets here. diff --git a/configs/mainnet/phase0.yaml b/configs/mainnet_preset/phase0.yaml similarity index 60% rename from configs/mainnet/phase0.yaml rename to configs/mainnet_preset/phase0.yaml index 8b902f1c3..d9a8b1243 100644 --- a/configs/mainnet/phase0.yaml +++ b/configs/mainnet_preset/phase0.yaml @@ -1,4 +1,4 @@ -# Mainnet preset +# Mainnet preset - Phase0 # Misc # --------------------------------------------------------------- @@ -8,16 +8,8 @@ MAX_COMMITTEES_PER_SLOT: 64 TARGET_COMMITTEE_SIZE: 128 # 2**11 (= 2,048) MAX_VALIDATORS_PER_COMMITTEE: 2048 -# 2**2 (= 4) -MIN_PER_EPOCH_CHURN_LIMIT: 4 -# 2**16 (= 65,536) -CHURN_LIMIT_QUOTIENT: 65536 # See issue 563 SHUFFLE_ROUND_COUNT: 90 -# `2**14` (= 16,384) -MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384 -# Dec 1, 2020, 12pm UTC -MIN_GENESIS_TIME: 1606824000 # 4 HYSTERESIS_QUOTIENT: 4 # 1 (minus 0.25) @@ -32,29 +24,6 @@ HYSTERESIS_UPWARD_MULTIPLIER: 5 SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 8 -# Validator -# --------------------------------------------------------------- -# 2**11 (= 2,048) -ETH1_FOLLOW_DISTANCE: 2048 -# 2**4 (= 16) -TARGET_AGGREGATORS_PER_COMMITTEE: 16 -# 2**0 (= 1) -RANDOM_SUBNETS_PER_VALIDATOR: 1 -# 2**8 (= 256) -EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256 -# 14 (estimate from Eth1 mainnet) -SECONDS_PER_ETH1_BLOCK: 14 - - -# Deposit contract -# --------------------------------------------------------------- -# Ethereum PoW Mainnet -DEPOSIT_CHAIN_ID: 1 -DEPOSIT_NETWORK_ID: 1 -# **TBD** -DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cBB839Cbe05303d7705Fa - - # Gwei values # --------------------------------------------------------------- # 2**0 * 10**9 (= 1,000,000,000) Gwei @@ -67,19 +36,8 @@ EJECTION_BALANCE: 16000000000 EFFECTIVE_BALANCE_INCREMENT: 1000000000 -# Initial values -# --------------------------------------------------------------- -# Mainnet initial fork version, recommend altering for testnets -GENESIS_FORK_VERSION: 0x00000000 -BLS_WITHDRAWAL_PREFIX: 0x00 - - # Time parameters # --------------------------------------------------------------- -# 604800 seconds (7 days) -GENESIS_DELAY: 604800 -# 12 seconds -SECONDS_PER_SLOT: 12 # 2**0 (= 1) slots 12 seconds MIN_ATTESTATION_INCLUSION_DELAY: 1 # 2**5 (= 32) slots 6.4 minutes @@ -90,17 +48,13 @@ MIN_SEED_LOOKAHEAD: 1 MAX_SEED_LOOKAHEAD: 4 # 2**6 (= 64) epochs ~6.8 hours EPOCHS_PER_ETH1_VOTING_PERIOD: 64 -# 2**13 (= 8,192) slots ~13 hours +# 2**13 (= 8,192) slots ~27 hours SLOTS_PER_HISTORICAL_ROOT: 8192 -# 2**8 (= 256) epochs ~27 hours -MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 -# 2**8 (= 256) epochs ~27 hours -SHARD_COMMITTEE_PERIOD: 256 # 2**2 (= 4) epochs 25.6 minutes MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4 -# State vector lengths +# State list lengths # --------------------------------------------------------------- # 2**16 (= 65,536) epochs ~0.8 years EPOCHS_PER_HISTORICAL_VECTOR: 65536 @@ -140,14 +94,3 @@ MAX_ATTESTATIONS: 128 MAX_DEPOSITS: 16 # 2**4 (= 16) MAX_VOLUNTARY_EXITS: 16 - - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_BEACON_PROPOSER: 0x00000000 -DOMAIN_BEACON_ATTESTER: 0x01000000 -DOMAIN_RANDAO: 0x02000000 -DOMAIN_DEPOSIT: 0x03000000 -DOMAIN_VOLUNTARY_EXIT: 0x04000000 -DOMAIN_SELECTION_PROOF: 0x05000000 -DOMAIN_AGGREGATE_AND_PROOF: 0x06000000 diff --git a/configs/mainnet/sharding.yaml b/configs/mainnet_preset/sharding.yaml similarity index 65% rename from configs/mainnet/sharding.yaml rename to configs/mainnet_preset/sharding.yaml index af7e94f00..9a81c8cdc 100644 --- a/configs/mainnet/sharding.yaml +++ b/configs/mainnet_preset/sharding.yaml @@ -1,12 +1,5 @@ # Mainnet preset - Sharding -# Fork -# --------------------------------------------------------------- -SHARDING_FORK_VERSION: 0x03000000 -# TBD, temporarily max uint64 value: 2**64 - 1 -SHARDING_FORK_EPOCH: 18446744073709551615 - - # Beacon-chain # --------------------------------------------------------------- # Misc @@ -33,8 +26,3 @@ TARGET_SAMPLES_PER_BLOCK: 1024 MAX_GASPRICE: 8589934592 # 2**3 (= 8) Gwei MIN_GASPRICE: 8 - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_SHARD_PROPOSER: 0x80000000 -DOMAIN_SHARD_COMMITTEE: 0x81000000 diff --git a/configs/minimal/altair.yaml b/configs/minimal/altair.yaml deleted file mode 100644 index f9b8401e1..000000000 --- a/configs/minimal/altair.yaml +++ /dev/null @@ -1,54 +0,0 @@ -# Minimal preset - Altair - -# Updated penalty values -# --------------------------------------------------------------- -# 3 * 2**24 (= 50,331,648) -INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 -# 2**6 (= 64) -MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 -# 2 -PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 - - -# Sync committee -# --------------------------------------------------------------- -# [customized] -SYNC_COMMITTEE_SIZE: 32 -# [customized] -EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 8 - - -# Misc -# --------------------------------------------------------------- -# 2**2 (= 4) -INACTIVITY_SCORE_BIAS: 4 -# 2**4 (= 16) -INACTIVITY_SCORE_RECOVERY_RATE: 16 - - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_SYNC_COMMITTEE: 0x07000000 -DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF: 0x08000000 -DOMAIN_CONTRIBUTION_AND_PROOF: 0x09000000 - - -# Fork -# --------------------------------------------------------------- -# [customized] Highest byte set to 0x01 to avoid collisions with mainnet versioning -ALTAIR_FORK_VERSION: 0x01000001 -# [customized] -ALTAIR_FORK_EPOCH: 18446744073709551615 - - -# Sync protocol -# --------------------------------------------------------------- -# 1 -MIN_SYNC_COMMITTEE_PARTICIPANTS: 1 - - - -# Validator -# --------------------------------------------------------------- -# 2**2 (= 4) -TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 4 diff --git a/configs/minimal/merge.yaml b/configs/minimal/merge.yaml deleted file mode 100644 index 3b50cd5ca..000000000 --- a/configs/minimal/merge.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Minimal preset - The Merge - -# Fork -# --------------------------------------------------------------- -MERGE_FORK_VERSION: 0x02000001 -# TBD, temporarily max uint64 value: 2**64 - 1 -MERGE_FORK_EPOCH: 18446744073709551615 diff --git a/configs/minimal_config.yaml b/configs/minimal_config.yaml new file mode 100644 index 000000000..150024a2a --- /dev/null +++ b/configs/minimal_config.yaml @@ -0,0 +1,73 @@ +# Minimal config + +# Extends the minimal preset +PRESET_BASE: 'minimal' + +# Genesis +# --------------------------------------------------------------- +# [customized] +MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64 +# Jan 3, 2020 +MIN_GENESIS_TIME: 1578009600 +# Highest byte set to 0x01 to avoid collisions with mainnet versioning +GENESIS_FORK_VERSION: 0x00000001 +# [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis +GENESIS_DELAY: 300 + + +# Forking +# --------------------------------------------------------------- +# Values provided for illustrative purposes. +# Individual tests/testnets may set different values. + +# Altair +ALTAIR_FORK_VERSION: 0x01000001 +ALTAIR_FORK_EPOCH: 18446744073709551615 +# Merge +MERGE_FORK_VERSION: 0x02000001 +MERGE_FORK_EPOCH: 18446744073709551615 +# Sharding +SHARDING_FORK_VERSION: 0x03000001 +SHARDING_FORK_EPOCH: 18446744073709551615 + +# TBD, ignore if 0. Merge transition approach is in active R&D. +TRANSITION_TOTAL_DIFFICULTY: 0 + + +# Time parameters +# --------------------------------------------------------------- +# [customized] Faster for testing purposes +SECONDS_PER_SLOT: 6 +# 14 (estimate from Eth1 mainnet) +SECONDS_PER_ETH1_BLOCK: 14 +# 2**8 (= 256) epochs +MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 +# [customized] higher frequency of committee turnover and faster time to acceptable voluntary exit +SHARD_COMMITTEE_PERIOD: 64 +# [customized] process deposits more quickly, but insecure +ETH1_FOLLOW_DISTANCE: 16 + + +# Inactivity penalties +# --------------------------------------------------------------- +# 2**2 (= 4) +INACTIVITY_SCORE_BIAS: 4 +# 2**4 (= 16) +INACTIVITY_SCORE_RECOVERY_RATE: 16 + + +# Validator Churn +# --------------------------------------------------------------- +# 2**2 (= 4) +MIN_PER_EPOCH_CHURN_LIMIT: 4 +# 2**16 (= 65,536) +CHURN_LIMIT_QUOTIENT: 65536 + + +# Deposit contract +# --------------------------------------------------------------- +# Ethereum Goerli testnet +DEPOSIT_CHAIN_ID: 5 +DEPOSIT_NETWORK_ID: 5 +# Configured on a per testnet basis +DEPOSIT_CONTRACT_ADDRESS: 0x1234567890123456789012345678901234567890 diff --git a/configs/minimal_preset/altair.yaml b/configs/minimal_preset/altair.yaml new file mode 100644 index 000000000..88d78bea3 --- /dev/null +++ b/configs/minimal_preset/altair.yaml @@ -0,0 +1,24 @@ +# Minimal preset - Altair + +# Updated penalty values +# --------------------------------------------------------------- +# 3 * 2**24 (= 50,331,648) +INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648 +# 2**6 (= 64) +MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64 +# 2 +PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2 + + +# Sync committee +# --------------------------------------------------------------- +# [customized] +SYNC_COMMITTEE_SIZE: 32 +# [customized] +EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 8 + + +# Sync protocol +# --------------------------------------------------------------- +# 1 +MIN_SYNC_COMMITTEE_PARTICIPANTS: 1 diff --git a/configs/minimal/custody_game.yaml b/configs/minimal_preset/custody_game.yaml similarity index 64% rename from configs/minimal/custody_game.yaml rename to configs/minimal_preset/custody_game.yaml index 8b8992fb6..c06fccad4 100644 --- a/configs/minimal/custody_game.yaml +++ b/configs/minimal_preset/custody_game.yaml @@ -13,14 +13,6 @@ CUSTODY_PERIOD_TO_RANDAO_PADDING: 8 # [customize for faster testing] MAX_CHUNK_CHALLENGE_DELAY: 64 -# Misc parameters -# --------------------------------------------------------------- -# 2**256 - 189 -CUSTODY_PRIME: 115792089237316195423570985008687907853269984665640564039457584007913129639747 -# 3 -CUSTODY_SECRETS: 3 -# 1/4 chance of custody bit 1 [customized for faster testing] -CUSTODY_PROBABILITY_EXPONENT: 2 # Max operations # --------------------------------------------------------------- @@ -35,14 +27,9 @@ MAX_CUSTODY_CHUNK_CHALLENGE_RESP: 8 # 2**0 (= 1) MAX_CUSTODY_SLASHINGS: 1 + # Reward and penalty quotients # --------------------------------------------------------------- EARLY_DERIVED_SECRET_REVEAL_SLOT_REWARD_MULTIPLE: 2 # 2**8 (= 256) MINOR_REWARD_QUOTIENT: 256 - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_CUSTODY_BIT_SLASHING: 0x83000000 -DOMAIN_LIGHT_SELECTION_PROOF: 0x84000000 -DOMAIN_LIGHT_AGGREGATE_AND_PROOF: 0x85000000 diff --git a/configs/minimal_preset/merge.yaml b/configs/minimal_preset/merge.yaml new file mode 100644 index 000000000..88aa86c09 --- /dev/null +++ b/configs/minimal_preset/merge.yaml @@ -0,0 +1,3 @@ +# Minimal preset - The Merge + +# No presets here. diff --git a/configs/minimal/phase0.yaml b/configs/minimal_preset/phase0.yaml similarity index 59% rename from configs/minimal/phase0.yaml rename to configs/minimal_preset/phase0.yaml index 3624a2702..c2b106759 100644 --- a/configs/minimal/phase0.yaml +++ b/configs/minimal_preset/phase0.yaml @@ -1,24 +1,15 @@ -# Minimal preset +# Minimal preset - Phase0 # Misc # --------------------------------------------------------------- - # [customized] Just 4 committees for slot for testing purposes MAX_COMMITTEES_PER_SLOT: 4 # [customized] unsecure, but fast TARGET_COMMITTEE_SIZE: 4 # 2**11 (= 2,048) MAX_VALIDATORS_PER_COMMITTEE: 2048 -# 2**2 (= 4) -MIN_PER_EPOCH_CHURN_LIMIT: 4 -# 2**16 (= 65,536) -CHURN_LIMIT_QUOTIENT: 65536 # [customized] Faster, but unsecure. SHUFFLE_ROUND_COUNT: 10 -# [customized] -MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64 -# Jan 3, 2020 -MIN_GENESIS_TIME: 1578009600 # 4 HYSTERESIS_QUOTIENT: 4 # 1 (minus 0.25) @@ -33,29 +24,6 @@ HYSTERESIS_UPWARD_MULTIPLIER: 5 SAFE_SLOTS_TO_UPDATE_JUSTIFIED: 2 -# Validator -# --------------------------------------------------------------- -# [customized] process deposits more quickly, but insecure -ETH1_FOLLOW_DISTANCE: 16 -# 2**4 (= 16) -TARGET_AGGREGATORS_PER_COMMITTEE: 16 -# 2**0 (= 1) -RANDOM_SUBNETS_PER_VALIDATOR: 1 -# 2**8 (= 256) -EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION: 256 -# 14 (estimate from Eth1 mainnet) -SECONDS_PER_ETH1_BLOCK: 14 - - -# Deposit contract -# --------------------------------------------------------------- -# Ethereum Goerli testnet -DEPOSIT_CHAIN_ID: 5 -DEPOSIT_NETWORK_ID: 5 -# Configured on a per testnet basis -DEPOSIT_CONTRACT_ADDRESS: 0x1234567890123456789012345678901234567890 - - # Gwei values # --------------------------------------------------------------- # 2**0 * 10**9 (= 1,000,000,000) Gwei @@ -68,19 +36,8 @@ EJECTION_BALANCE: 16000000000 EFFECTIVE_BALANCE_INCREMENT: 1000000000 -# Initial values -# --------------------------------------------------------------- -# Highest byte set to 0x01 to avoid collisions with mainnet versioning -GENESIS_FORK_VERSION: 0x00000001 -BLS_WITHDRAWAL_PREFIX: 0x00 - - # Time parameters # --------------------------------------------------------------- -# [customized] Faster to spin up testnets, but does not give validator reasonable warning time for genesis -GENESIS_DELAY: 300 -# [customized] Faster for testing purposes -SECONDS_PER_SLOT: 6 # 2**0 (= 1) slots 6 seconds MIN_ATTESTATION_INCLUSION_DELAY: 1 # [customized] fast epochs @@ -93,15 +50,11 @@ MAX_SEED_LOOKAHEAD: 4 EPOCHS_PER_ETH1_VOTING_PERIOD: 4 # [customized] smaller state SLOTS_PER_HISTORICAL_ROOT: 64 -# 2**8 (= 256) epochs -MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 -# [customized] higher frequency of committee turnover and faster time to acceptable voluntary exit -SHARD_COMMITTEE_PERIOD: 64 # 2**2 (= 4) epochs MIN_EPOCHS_TO_INACTIVITY_PENALTY: 4 -# State vector lengths +# State list lengths # --------------------------------------------------------------- # [customized] smaller state EPOCHS_PER_HISTORICAL_VECTOR: 64 @@ -141,14 +94,3 @@ MAX_ATTESTATIONS: 128 MAX_DEPOSITS: 16 # 2**4 (= 16) MAX_VOLUNTARY_EXITS: 16 - - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_BEACON_PROPOSER: 0x00000000 -DOMAIN_BEACON_ATTESTER: 0x01000000 -DOMAIN_RANDAO: 0x02000000 -DOMAIN_DEPOSIT: 0x03000000 -DOMAIN_VOLUNTARY_EXIT: 0x04000000 -DOMAIN_SELECTION_PROOF: 0x05000000 -DOMAIN_AGGREGATE_AND_PROOF: 0x06000000 diff --git a/configs/minimal/sharding.yaml b/configs/minimal_preset/sharding.yaml similarity index 67% rename from configs/minimal/sharding.yaml rename to configs/minimal_preset/sharding.yaml index 2db2acffa..7dedbc926 100644 --- a/configs/minimal/sharding.yaml +++ b/configs/minimal_preset/sharding.yaml @@ -1,12 +1,5 @@ # Minimal preset - Sharding -# Fork -# --------------------------------------------------------------- -SHARDING_FORK_VERSION: 0x03000001 -# TBD, temporarily max uint64 value: 2**64 - 1 -SHARDING_FORK_EPOCH: 18446744073709551615 - - # Beacon-chain # --------------------------------------------------------------- # Misc @@ -33,8 +26,3 @@ TARGET_SAMPLES_PER_BLOCK: 1024 MAX_GASPRICE: 8589934592 # 2**3 (= 8) Gwei MIN_GASPRICE: 8 - -# Signature domains -# --------------------------------------------------------------- -DOMAIN_SHARD_PROPOSER: 0x80000000 -DOMAIN_SHARD_COMMITTEE: 0x81000000 diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index c003280c7..21eb084cd 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -17,7 +17,7 @@ - [Updated penalty values](#updated-penalty-values) - [Sync committee](#sync-committee) - [Configuration](#configuration) - - [Misc](#misc-1) + - [Inactivity penalties](#inactivity-penalties) - [Containers](#containers) - [Modified containers](#modified-containers) - [`BeaconBlockBody`](#beaconblockbody) @@ -28,7 +28,7 @@ - [Helper functions](#helper-functions) - [`Predicates`](#predicates) - [`eth2_fast_aggregate_verify`](#eth2_fast_aggregate_verify) - - [Misc](#misc-2) + - [Misc](#misc-1) - [`add_flag`](#add_flag) - [`has_flag`](#has_flag) - [Beacon state accessors](#beacon-state-accessors) @@ -133,7 +133,7 @@ This patch updates a few configuration values to move penalty parameters closer ## Configuration -### Misc +### Inactivity penalties | Name | Value | Unit | | - | - | :-: | :-: | diff --git a/specs/custody_game/beacon-chain.md b/specs/custody_game/beacon-chain.md index 4f5e80630..ad99527f7 100644 --- a/specs/custody_game/beacon-chain.md +++ b/specs/custody_game/beacon-chain.md @@ -71,6 +71,12 @@ building upon the [Sharding](../sharding/beacon-chain.md) specification. | `BYTES_PER_CUSTODY_ATOM` | `uint64(32)` | bytes | | `CUSTODY_PROBABILITY_EXPONENT` | `uint64(10)` | - | +### Domain types + +| Name | Value | +| - | - | +| `DOMAIN_CUSTODY_BIT_SLASHING` | `DomainType('0x83000000')` | + ## Preset ### Time parameters diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index 6eb7891cb..b394f8e3c 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -20,8 +20,9 @@ - [Rewards and penalties](#rewards-and-penalties) - [Max operations per block](#max-operations-per-block) - [Configuration](#configuration) - - [General](#general) + - [Genesis settings](#genesis-settings) - [Time parameters](#time-parameters-1) + - [Validator Churn](#validator-churn) - [Containers](#containers) - [Misc dependencies](#misc-dependencies) - [`Fork`](#fork) @@ -285,26 +286,29 @@ Additional preset configurations can be found in the [`configs`](../../configs) Defaults for this more dynamic type of configuration are available with the presets in the [`configs`](../../configs) directory. Testnets and other types of chain instances may use a different configuration. -### General +### Genesis settings | Name | Value | | - | - | | `MIN_GENESIS_ACTIVE_VALIDATOR_COUNT` | `uint64(2**14)` (= 16,384) | | `MIN_GENESIS_TIME` | `uint64(1606824000)` (Dec 1, 2020, 12pm UTC) | | `GENESIS_FORK_VERSION` | `Version('0x00000000')` | -| `ETH1_FOLLOW_DISTANCE` | `uint64(2**11)` (= 2,048) | -| `MIN_PER_EPOCH_CHURN_LIMIT` | `uint64(2**2)` (= 4) | -| `CHURN_LIMIT_QUOTIENT` | `uint64(2**16)` (= 65,536) | +| `GENESIS_DELAY` | `uint64(604800)` (7 days) | ### Time parameters | Name | Value | Unit | Duration | | - | - | :-: | :-: | -| `GENESIS_DELAY` | `uint64(604800)` | seconds | 7 days | | `SECONDS_PER_SLOT` | `uint64(12)` | seconds | 12 seconds | | `SECONDS_PER_ETH1_BLOCK` | `uint64(14)` | seconds | 14 seconds | | `MIN_VALIDATOR_WITHDRAWABILITY_DELAY` | `uint64(2**8)` (= 256) | epochs | ~27 hours | | `SHARD_COMMITTEE_PERIOD` | `uint64(2**8)` (= 256) | epochs | ~27 hours | +| `ETH1_FOLLOW_DISTANCE` | `uint64(2**11)` (= 2,048) | Eth1 blocks | ~8 hours | + +### Validator Churn + +| `MIN_PER_EPOCH_CHURN_LIMIT` | `uint64(2**2)` (= 4) | +| `CHURN_LIMIT_QUOTIENT` | `uint64(2**16)` (= 65,536) | ## Containers diff --git a/specs/phase0/fork-choice.md b/specs/phase0/fork-choice.md index b5689ecd2..181a874fb 100644 --- a/specs/phase0/fork-choice.md +++ b/specs/phase0/fork-choice.md @@ -7,7 +7,7 @@ - [Introduction](#introduction) - [Fork choice](#fork-choice) - - [Configuration](#configuration) + - [Preset](#preset) - [Helpers](#helpers) - [`LatestMessage`](#latestmessage) - [`Store`](#store) @@ -55,7 +55,7 @@ Any of the above handlers that trigger an unhandled exception (e.g. a failed ass 4) **Manual forks**: Manual forks may arbitrarily change the fork choice rule but are expected to be enacted at epoch transitions, with the fork details reflected in `state.fork`. 5) **Implementation**: The implementation found in this specification is constructed for ease of understanding rather than for optimization in computation, space, or any other resource. A number of optimized alternatives can be found [here](https://github.com/protolambda/lmd-ghost). -### Configuration +### Preset | Name | Value | Unit | Duration | | - | - | :-: | :-: |