Skip to content

Commit 5653d73

Browse files
authored
Merge branch 'dev' into upgrade-to-electra-tests
2 parents d53419b + 49b6840 commit 5653d73

33 files changed

+1148
-187
lines changed

.github/workflows/run-tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,18 @@ jobs:
110110
with:
111111
name: test-reports-${{ matrix.version }}
112112
path: tests/core/pyspec/test-reports
113+
114+
gen-modcheck:
115+
runs-on: [self-hosted-ghr-custom, size-s-x64, profile-consensusSpecs]
116+
steps:
117+
- name: Checkout repository
118+
uses: actions/checkout@v4
119+
- name: Setup Python
120+
uses: actions/setup-python@v5
121+
with:
122+
python-version: '3.12.4'
123+
cache: ''
124+
- name: Install pyspec requirements
125+
run: make install_test
126+
- name: Run generators with --modcheck
127+
run: make generate_tests modcheck=true

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ COV_HTML_OUT_DIR=$(PY_SPEC_DIR)/$(COV_HTML_OUT)
4141
COV_INDEX_FILE=$(COV_HTML_OUT_DIR)/index.html
4242

4343
CURRENT_DIR = ${CURDIR}
44-
LINTER_CONFIG_FILE = $(CURRENT_DIR)/linter.ini
4544
GENERATOR_ERROR_LOG_FILE = $(CURRENT_DIR)/$(TEST_VECTOR_DIR)/testgen_error_log.txt
4645

4746
SCRIPTS_DIR = ${CURRENT_DIR}/scripts
@@ -151,13 +150,16 @@ codespell:
151150

152151
lint: pyspec
153152
. venv/bin/activate; cd $(PY_SPEC_DIR); \
154-
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
155-
&& python -m pylint --rcfile $(LINTER_CONFIG_FILE) $(PYLINT_SCOPE) \
156-
&& python -m mypy --config-file $(LINTER_CONFIG_FILE) $(MYPY_SCOPE)
153+
flake8 --config $(CURRENT_DIR)/flake8.ini ./eth2spec \
154+
&& python -m pylint --rcfile $(CURRENT_DIR)/pylint.ini $(PYLINT_SCOPE) \
155+
&& python -m mypy --config-file $(CURRENT_DIR)/mypy.ini $(MYPY_SCOPE)
157156

158157
lint_generators: pyspec
159158
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
160-
flake8 --config $(LINTER_CONFIG_FILE)
159+
flake8 --config $(CURRENT_DIR)/flake8.ini
160+
161+
# If set to true, it will not run generator tests.
162+
modcheck ?= false
161163

162164
# Runs a generator, identified by param 1
163165
define run_generator
@@ -177,7 +179,7 @@ define run_generator
177179
. venv/bin/activate; \
178180
pip3 install ../../../dist/eth2spec-*.whl; \
179181
pip3 install 'eth2spec[generator]'; \
180-
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR); \
182+
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR) $(if $(filter true,$(modcheck)),--modcheck); \
181183
echo "generator $(1) finished"
182184
endef
183185

flake8.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
ignore = E252,W504,W503
3+
max-line-length = 120

linter.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

mypy.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[mypy]
2+
disallow_incomplete_defs = True
3+
disallow_untyped_defs = True
4+
warn_unused_ignores = True
5+
warn_unused_configs = True
6+
warn_redundant_casts = True
7+
ignore_missing_imports = True

pylint.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[MESSAGES CONTROL]
2+
disable = all
3+
enable = unused-argument

pysetup/md_doc_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
DENEB: CAPELLA,
2323
ELECTRA: DENEB,
2424
WHISK: CAPELLA,
25-
EIP7594: DENEB,
25+
EIP7594: ELECTRA,
2626
EIP6800: DENEB,
2727
EIP7732: ELECTRA,
2828
}

pysetup/spec_builders/eip7594.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class EIP7594SpecBuilder(BaseSpecBuilder):
1010
@classmethod
1111
def imports(cls, preset_name: str):
1212
return f'''
13-
from eth2spec.deneb import {preset_name} as deneb
13+
from eth2spec.electra import {preset_name} as electra
1414
'''
1515

1616

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def run(self):
561561
python_requires=">=3.9, <4",
562562
extras_require={
563563
"test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
564-
"lint": ["flake8==5.0.4", "mypy==0.981", "pylint==2.15.3"],
564+
"lint": ["flake8==5.0.4", "mypy==0.981", "pylint==3.3.1"],
565565
"generator": ["setuptools>=72.0.0", "pytest>4.4", "python-snappy==0.7.3", "filelock", "pathos==0.3.0"],
566566
"docs": ["mkdocs==1.4.2", "mkdocs-material==9.1.5", "mdx-truly-sane-lists==1.3", "mkdocs-awesome-pages-plugin==2.8.0"]
567567
},
@@ -572,7 +572,7 @@ def run(self):
572572
"py_ecc==6.0.0",
573573
"milagro_bls_binding==1.9.0",
574574
"remerkleable==0.1.28",
575-
"trie==2.0.2",
575+
"trie>=3,<4",
576576
RUAMEL_YAML_VERSION,
577577
"lru-dict==1.2.0",
578578
MARKO_VERSION,

specs/_features/eip7594/fork.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def compute_fork_version(epoch: Epoch) -> Version:
4444
"""
4545
if epoch >= EIP7594_FORK_EPOCH:
4646
return EIP7594_FORK_VERSION
47+
if epoch >= ELECTRA_FORK_EPOCH:
48+
return ELECTRA_FORK_VERSION
4749
if epoch >= DENEB_FORK_EPOCH:
4850
return DENEB_FORK_VERSION
4951
if epoch >= CAPELLA_FORK_EPOCH:
@@ -71,8 +73,8 @@ If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) ==
7173
an irregular state change is made to upgrade to EIP7594.
7274

7375
```python
74-
def upgrade_to_eip7594(pre: deneb.BeaconState) -> BeaconState:
75-
epoch = deneb.get_current_epoch(pre)
76+
def upgrade_to_eip7594(pre: electra.BeaconState) -> BeaconState:
77+
epoch = electra.get_current_epoch(pre)
7678
post = BeaconState(
7779
# Versioning
7880
genesis_time=pre.genesis_time,
@@ -119,6 +121,17 @@ def upgrade_to_eip7594(pre: deneb.BeaconState) -> BeaconState:
119121
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
120122
# Deep history valid from Capella onwards
121123
historical_summaries=pre.historical_summaries,
124+
# On-chain deposits
125+
deposit_requests_start_index=pre.deposit_requests_start_index,
126+
# Consolidations
127+
deposit_balance_to_consume=pre.deposit_balance_to_consume,
128+
exit_balance_to_consume=pre.exit_balance_to_consume,
129+
earliest_exit_epoch=pre.earliest_exit_epoch,
130+
consolidation_balance_to_consume=pre.consolidation_balance_to_consume,
131+
earliest_consolidation_epoch=pre.earliest_consolidation_epoch,
132+
pending_balance_deposits=pre.pending_balance_deposits,
133+
pending_partial_withdrawals=pre.pending_partial_withdrawals,
134+
pending_consolidations=pre.pending_consolidations,
122135
)
123136

124137
return post

0 commit comments

Comments
 (0)