Skip to content

Commit

Permalink
Add EIP-7251 to Electra fork
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Apr 9, 2024
1 parent 4e8e178 commit 3e356d0
Show file tree
Hide file tree
Showing 30 changed files with 1,064 additions and 1,591 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ tests/core/pyspec/eth2spec/capella/
tests/core/pyspec/eth2spec/deneb/
tests/core/pyspec/eth2spec/electra/
tests/core/pyspec/eth2spec/whisk/
tests/core/pyspec/eth2spec/eip7251/
tests/core/pyspec/eth2spec/eip7594/

# coverage reports
Expand Down
7 changes: 2 additions & 5 deletions configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
# Electra
ELECTRA_FORK_VERSION: 0x05000000
ELECTRA_FORK_EPOCH: 18446744073709551615
# EIP7251
EIP7251_FORK_VERSION: 0x06000000 # temporary stub
EIP7251_FORK_EPOCH: 18446744073709551615
# WHISK
WHISK_FORK_VERSION: 0x08000000 # temporary stub
WHISK_FORK_EPOCH: 18446744073709551615
Expand Down Expand Up @@ -163,6 +160,6 @@ NUMBER_OF_COLUMNS: 128
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384

# [New in EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_EIP7251: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000 # 2**8 * 10**9 (= 256,000,000,000)
7 changes: 2 additions & 5 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ DENEB_FORK_EPOCH: 18446744073709551615
# Electra
ELECTRA_FORK_VERSION: 0x05000001
ELECTRA_FORK_EPOCH: 18446744073709551615
# EIP7251
EIP7251_FORK_VERSION: 0x06000001 # temporary stub
EIP7251_FORK_EPOCH: 18446744073709551615
# WHISK
WHISK_FORK_VERSION: 0x08000001
WHISK_FORK_EPOCH: 18446744073709551615
Expand Down Expand Up @@ -161,6 +158,6 @@ NUMBER_OF_COLUMNS: 128
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384

# [New in EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_EIP7251: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
28 changes: 0 additions & 28 deletions presets/mainnet/eip7251.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions presets/mainnet/electra.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
# Mainnet preset - Electra

# Gwei values
# ---------------------------------------------------------------
# 2**5 * 10**9 (= 32,000,000,000) Gwei
MIN_ACTIVATION_BALANCE: 32000000000
# 2**11 * 10**9 (= 2,048,000,000,000) Gwei
MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000

# State list lengths
# ---------------------------------------------------------------
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728
PENDING_CONSOLIDATIONS_LIMIT: 262144

# Reward and penalty quotients
# ---------------------------------------------------------------
MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA: 4096
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096

# # Max operations per block
# ---------------------------------------------------------------
# `uint64(2**0)` (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# `uint64(2 * 3)` (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
MAX_CONSOLIDATIONS: 1

# Execution
# ---------------------------------------------------------------
# 2**13 (= 8192) receipts
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 8192
# 2**4 (= 16) exits
MAX_EXECUTION_LAYER_EXITS: 16
# 2**3 (= 8) partial withdrawals
MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD: 8
30 changes: 0 additions & 30 deletions presets/minimal/eip7251.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions presets/minimal/electra.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
# Minimal preset - Electra

# Gwei values
# ---------------------------------------------------------------
# 2**5 * 10**9 (= 32,000,000,000) Gwei
MIN_ACTIVATION_BALANCE: 32000000000
# 2**11 * 10**9 (= 2,048,000,000,000) Gwei
MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000

# State list lengths
# ---------------------------------------------------------------
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
# [customized] smaller queue
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
# [customized] smaller queue
PENDING_CONSOLIDATIONS_LIMIT: 64

# Reward and penalty quotients
# ---------------------------------------------------------------
MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA: 4096
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096

# # Max operations per block
# ---------------------------------------------------------------
# `uint64(2**0)` (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# `uint64(2 * 3)` (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
MAX_CONSOLIDATIONS: 1

# Execution
# ---------------------------------------------------------------
# [customized]
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4
# 2**4 (= 16) exits
MAX_EXECUTION_LAYER_EXITS: 16
# [customized] 2**1 (= 2)
MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD: 2
1 change: 0 additions & 1 deletion pysetup/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
DENEB = 'deneb'
ELECTRA = 'electra'
EIP7594 = 'eip7594'
EIP7251 = 'eip7251'
WHISK = 'whisk'


Expand Down
2 changes: 0 additions & 2 deletions pysetup/md_doc_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
ELECTRA,
WHISK,
EIP7594,
EIP7251,
)


Expand All @@ -21,7 +20,6 @@
DENEB: CAPELLA,
ELECTRA: DENEB,
WHISK: CAPELLA,
EIP7251: DENEB,
EIP7594: DENEB,
}

Expand Down
3 changes: 1 addition & 2 deletions pysetup/spec_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
from .deneb import DenebSpecBuilder
from .electra import ElectraSpecBuilder
from .whisk import WhiskSpecBuilder
from .eip7251 import EIP7251SpecBuilder
from .eip7594 import EIP7594SpecBuilder


spec_builders = {
builder.fork: builder
for builder in (
Phase0SpecBuilder, AltairSpecBuilder, BellatrixSpecBuilder, CapellaSpecBuilder, DenebSpecBuilder,
ElectraSpecBuilder, WhiskSpecBuilder, EIP7594SpecBuilder, EIP7251SpecBuilder,
ElectraSpecBuilder, WhiskSpecBuilder, EIP7594SpecBuilder,
)
}
24 changes: 0 additions & 24 deletions pysetup/spec_builders/eip7251.py

This file was deleted.

11 changes: 11 additions & 0 deletions pysetup/spec_builders/electra.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Dict
from .base import BaseSpecBuilder
from ..constants import ELECTRA

Expand All @@ -10,3 +11,13 @@ def imports(cls, preset_name: str):
return f'''
from eth2spec.deneb import {preset_name} as deneb
'''

## TODO: deal with changed gindices

@classmethod
def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
return {
'FINALIZED_ROOT_GINDEX': 'GeneralizedIndex(169)',
'CURRENT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(86)',
'NEXT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(87)',
}
Loading

0 comments on commit 3e356d0

Please sign in to comment.