Skip to content

Commit

Permalink
Commit config and preset to spec (#25)
Browse files Browse the repository at this point in the history
* commit config and preset to spec

* update diff table

* drop unused preset

* fix format

* cleanup table
  • Loading branch information
dapplion authored Nov 9, 2023
1 parent f295cca commit 6cad438
Show file tree
Hide file tree
Showing 9 changed files with 534 additions and 48 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ethereum_config_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ethereum key check

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at 00:00 UTC

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install PyYAML
run: pip install PyYAML

- name: Check keys
# --dev checks against an unpinned commit. since new vars can be added at any time unpinned commits
# are checked on a cron, not on regular flows.
run: python scripts/assert_declare_ethereum_vars.py ${{ github.event_name == 'schedule' && '--dev' || '' }}

72 changes: 24 additions & 48 deletions consensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,28 @@ Refer to [gnosischain/configs/mainnet/config.yaml](https://github.com/gnosischai

Note that modified preset values will result in different SSZ data structures, such that a client compiled with the Ethereum mainnet preset can't deserialize a state from the Gnosis Beacon Chain.

### phase0
```
ETHEREUM_SPEC_COMMIT: v1.4.0-beta.4
```

### Preset diff

| Name | Ethereum spec | Gnosis spec |
| -------------------------------------- | ------- | ------ |
| `BASE_REWARD_FACTOR` | `64` | `25` |
| `SLOTS_PER_EPOCH` | `32` | `16` |
| `EPOCHS_PER_SYNC_COMMITTEE_PERIOD` | `256` | `512` |
| `MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP` | `16384` | `8192` |
| `MAX_WITHDRAWALS_PER_PAYLOAD` | `16` | `8` |

### Config diff

| Name | Ethereum spec | Gnosis spec |
| --------------------------------------- | ------------- | ------------ |
| `CHURN_LIMIT_QUOTIENT` | `65536` | `4096` |
| `SECONDS_PER_SLOT` | `12` | `5` |
| `SECONDS_PER_ETH1_BLOCK` | `14` | `6` |
| `ETH1_FOLLOW_DISTANCE` | `2048` | `1024` |
| `MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT` | `8` | `2` |
| `MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS` | `4096` | `16384` |

**Preset**

| Name | Value |
| -------------------- | ----- |
| `BASE_REWARD_FACTOR` | `25` |
| `SLOTS_PER_EPOCH` | `16` |

**Config**

| Name | Value |
| ------------------------------------ | -------------------------------------------- |
| `SECONDS_PER_SLOT` | `5` |
| `SECONDS_PER_ETH1_BLOCK` | `6` |
| `ETH1_FOLLOW_DISTANCE` | `1024` |
| `CHURN_LIMIT_QUOTIENT` | `4096` |
| `DEPOSIT_CHAIN_ID` | `100` |
| `DEPOSIT_NETWORK_ID` | `100` |
| `DEPOSIT_CONTRACT_ADDRESS` | `0x0b98057ea310f4d31f2a452b414647007d1645d9` |
| `MIN_GENESIS_TIME` | `1638968400` |
| `MIN_GENESIS_ACTIVE_VALIDATOR_COUNT` | `4096` |
| `GENESIS_FORK_VERSION` | `0x00000064` |
| `GENESIS_DELAY` | `6000` |

### altair

**Preset**

| Name | Value |
| ---------------------------------- | ----- |
| `EPOCHS_PER_SYNC_COMMITTEE_PERIOD` | `512` |

**Config**

| Name | Value |
| --------------------- | ------------ |
| `ALTAIR_FORK_VERSION` | `0x01000064` |
| `ALTAIR_FORK_EPOCH` | `512` |

### bellatrix

**Config**

| Name | Value |
| --------------------------- | ------------------------------------------------ |
| `BELLATRIX_FORK_VERSION` | `0x02000064` |
| `BELLATRIX_FORK_EPOCH` | `385536` |
| `TERMINAL_TOTAL_DIFFICULTY` | `8626000000000000000000058750000000000000000000` |
151 changes: 151 additions & 0 deletions consensus/config/gnosis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
PRESET_BASE: 'gnosis'

# Free-form short name of the network that this configuration applies to - known
# canonical network names include:
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: 'gnosis'

# Transition
# ---------------------------------------------------------------
# Estimated on Dec 5, 2022
TERMINAL_TOTAL_DIFFICULTY: 8626000000000000000000058750000000000000000000
# By default, don't use these params
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615


# Genesis
# ---------------------------------------------------------------
# `2**12` (= 4,096)
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 4096
# Dec 08, 2021, 13:00 UTC
MIN_GENESIS_TIME: 1638968400
# GBC area code
GENESIS_FORK_VERSION: 0x00000064
# Customized for GBC: ~1 hour
GENESIS_DELAY: 6000


# Forking
# ---------------------------------------------------------------
# Some forks are disabled for now:
# - These may be re-assigned to another fork-version later
# - Temporarily set to max uint64 value: 2**64 - 1

# Altair
ALTAIR_FORK_VERSION: 0x01000064
ALTAIR_FORK_EPOCH: 512
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000064
BELLATRIX_FORK_EPOCH: 385536 # 2022-11-30T19:23:40.000Z
# Capella
CAPELLA_FORK_VERSION: 0x03000064
CAPELLA_FORK_EPOCH: 648704 # 2023-08-01T11:34:20.000Z
# Deneb
DENEB_FORK_VERSION: 0x04000064
DENEB_FORK_EPOCH: 18446744073709551615
# EIP6110
EIP6110_FORK_VERSION: 0x05000064 # temporary stub
EIP6110_FORK_EPOCH: 18446744073709551615
# EIP7002
EIP7002_FORK_VERSION: 0x05000064 # temporary stub
EIP7002_FORK_EPOCH: 18446744073709551615
# WHISK
WHISK_FORK_VERSION: 0x06000064 # temporary stub
WHISK_FORK_EPOCH: 18446744073709551615


# Time parameters
# ---------------------------------------------------------------
# 5 seconds
SECONDS_PER_SLOT: 5
# 6 (estimate from xDai mainnet)
SECONDS_PER_ETH1_BLOCK: 6
# 2**8 (= 256) epochs ~27 hours
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
# 2**8 (= 256) epochs ~27 hours
SHARD_COMMITTEE_PERIOD: 256
# 2**10 (= 1024) ~1.4 hour
ETH1_FOLLOW_DISTANCE: 1024


# Validator cycle
# ---------------------------------------------------------------
# 2**2 (= 4)
INACTIVITY_SCORE_BIAS: 4
# 2**4 (= 16)
INACTIVITY_SCORE_RECOVERY_RATE: 16
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**12 (= 4096)
CHURN_LIMIT_QUOTIENT: 4096
# [New in Deneb:EIP7514] 2*
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 2

# Fork choice
# ---------------------------------------------------------------
# 40%
PROPOSER_SCORE_BOOST: 40
# 20%
REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs
REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2


# Deposit contract
# ---------------------------------------------------------------
# xDai Mainnet
DEPOSIT_CHAIN_ID: 100
DEPOSIT_NETWORK_ID: 100
DEPOSIT_CONTRACT_ADDRESS: 0x0B98057eA310F4d31F2a452B414647007d1645d9

# Networking
# ---------------------------------------------------------------
# `10 * 2**20` (= 10485760, 10 MiB)
GOSSIP_MAX_SIZE: 10485760
# `2**10` (= 1024)
MAX_REQUEST_BLOCKS: 1024
# `2**8` (= 256)
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
# `10 * 2**20` (=10485760, 10 MiB)
MAX_CHUNK_SIZE: 10485760
# 5s
TTFB_TIMEOUT: 5
# 10s
RESP_TIMEOUT: 10
ATTESTATION_PROPAGATION_SLOT_RANGE: 32
# 500ms
MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500
MESSAGE_DOMAIN_INVALID_SNAPPY: 0x00000000
MESSAGE_DOMAIN_VALID_SNAPPY: 0x01000000
# 2 subnets per node
SUBNETS_PER_NODE: 2
# 2**8 (= 64)
ATTESTATION_SUBNET_COUNT: 64
ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
ATTESTATION_SUBNET_PREFIX_BITS: 6

# Deneb
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768
# `2**14` (= 16384 epochs, ~15 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Whisk
# `Epoch(2**8)`
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 256
# `Epoch(2)`
WHISK_PROPOSER_SELECTION_GAP: 2
26 changes: 26 additions & 0 deletions consensus/preset/gnosis/altair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
# SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD (= 32 * 256)
UPDATE_TIMEOUT: 8192
21 changes: 21 additions & 0 deletions consensus/preset/gnosis/bellatrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Mainnet preset - Bellatrix

# Updated penalty values
# ---------------------------------------------------------------
# 2**24 (= 16,777,216)
INACTIVITY_PENALTY_QUOTIENT_BELLATRIX: 16777216
# 2**5 (= 32)
MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX: 32
# 3
PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX: 3

# Execution
# ---------------------------------------------------------------
# 2**30 (= 1,073,741,824)
MAX_BYTES_PER_TRANSACTION: 1073741824
# 2**20 (= 1,048,576)
MAX_TRANSACTIONS_PER_PAYLOAD: 1048576
# 2**8 (= 256)
BYTES_PER_LOGS_BLOOM: 256
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32
17 changes: 17 additions & 0 deletions consensus/preset/gnosis/capella.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Mainnet preset - Capella

# Misc
# Max operations per block
# ---------------------------------------------------------------
# 2**4 (= 16)
MAX_BLS_TO_EXECUTION_CHANGES: 16

# Execution
# ---------------------------------------------------------------
# 2**3 (= 8) withdrawals
MAX_WITHDRAWALS_PER_PAYLOAD: 8

# Withdrawals processing
# ---------------------------------------------------------------
# 2**13 (= 8192) validators
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP: 8192
12 changes: 12 additions & 0 deletions consensus/preset/gnosis/deneb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Mainnet preset - Deneb

# Misc
# ---------------------------------------------------------------
# `uint64(4096)`
FIELD_ELEMENTS_PER_BLOB: 4096
# `uint64(2**12)` (= 4096)
MAX_BLOB_COMMITMENTS_PER_BLOCK: 4096
# `uint64(6)`
MAX_BLOBS_PER_BLOCK: 6
# `floorlog2(get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments')) + 1 + ceillog2(MAX_BLOB_COMMITMENTS_PER_BLOCK)` = 4 + 1 + 12 = 17
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 17
Loading

0 comments on commit 6cad438

Please sign in to comment.