Skip to content

Commit ec64491

Browse files
committed
Merge branch 'dev' into eip-7495
2 parents 4318f7b + 28f9f07 commit ec64491

File tree

58 files changed

+2841
-1153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2841
-1153
lines changed

.github/workflows/generate_vectors.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
5252
cp -r presets/ ../consensus-spec-tests/presets
5353
cp -r configs/ ../consensus-spec-tests/configs
5454
find . -type d -empty -delete
55+
- name: Check for errors
56+
run: |
57+
if grep -q "\[ERROR\]" consensustestgen.log; then
58+
echo "There is an error in the log"
59+
exit 1
60+
fi
61+
if find . -type f -name "INCOMPLETE" | grep -q "INCOMPLETE"; then
62+
echo "There is an INCOMPLETE file"
63+
exit 1
64+
fi
5565
- name: Archive configurations
5666
run: |
5767
cd consensus-spec-tests

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/*/*.md) \
3434
$(wildcard $(SPEC_DIR)/_features/*/*/*.md) \
3535
$(wildcard $(SSZ_DIR)/*.md)
3636

37-
ALL_EXECUTABLE_SPEC_NAMES = phase0 altair bellatrix capella deneb electra whisk eip6800 eip7732
37+
ALL_EXECUTABLE_SPEC_NAMES = phase0 altair bellatrix capella deneb electra whisk eip6800 eip7594 eip7732
3838
# The parameters for commands. Use `foreach` to avoid listing specs again.
3939
COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), --cov=eth2spec.$S.$(TEST_PRESET_TYPE))
4040
PYLINT_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), ./eth2spec/$S)
@@ -105,7 +105,7 @@ generate_tests: $(GENERATOR_TARGETS)
105105

106106
# "make pyspec" to create the pyspec for all phases.
107107
pyspec:
108-
python3 -m venv venv; . venv/bin/activate; python3 setup.py pyspecdev
108+
@python3 -m venv venv; . venv/bin/activate; python3 setup.py pyspecdev
109109

110110
# check the setup tool requirements
111111
preinstallation:
@@ -141,13 +141,21 @@ endif
141141
open_cov:
142142
((open "$(COV_INDEX_FILE)" || xdg-open "$(COV_INDEX_FILE)") &> /dev/null) &
143143

144+
# Check all files and error if any ToC were modified.
144145
check_toc: $(MARKDOWN_FILES:=.toc)
146+
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0
145147

148+
# Generate ToC sections & save copy of original if modified.
146149
%.toc:
147-
cp $* $*.tmp && \
148-
doctoc $* && \
149-
diff -q $* $*.tmp && \
150-
rm $*.tmp
150+
@cp $* $*.tmp; \
151+
doctoc $* > /dev/null; \
152+
if diff -q $* $*.tmp > /dev/null; then \
153+
echo "Good $*"; \
154+
rm $*.tmp; \
155+
else \
156+
echo "\033[1;33m Bad $*\033[0m"; \
157+
echo "\033[1;34m See $*.tmp\033[0m"; \
158+
fi
151159

152160
codespell:
153161
codespell . --skip "./.git,./venv,$(PY_SPEC_DIR)/.mypy_cache" -I .codespell-whitelist

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository hosts the current Ethereum proof-of-stake specifications. Discus
88

99
## Specs
1010

11-
[![GitHub release](https://img.shields.io/github/v/release/ethereum/eth2.0-specs)](https://github.com/ethereum/eth2.0-specs/releases/) [![PyPI version](https://badge.fury.io/py/eth2spec.svg)](https://badge.fury.io/py/eth2spec)
11+
[![GitHub release](https://img.shields.io/github/v/release/ethereum/consensus-specs)](https://github.com/ethereum/consensus-specs/releases/) [![PyPI version](https://badge.fury.io/py/eth2spec.svg)](https://badge.fury.io/py/eth2spec) [![testgen](https://github.com/ethereum/consensus-specs/actions/workflows/generate_vectors.yml/badge.svg?branch=dev&event=schedule)](https://github.com/ethereum/consensus-specs/actions/workflows/generate_vectors.yml)
1212

1313
Core specifications for Ethereum proof-of-stake clients can be found in [specs](specs/). These are divided into features.
1414
Features are researched and developed in parallel, and then consolidated into sequential upgrades when ready.

presets/mainnet/electra.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
1010
# State list lengths
1111
# ---------------------------------------------------------------
1212
# `uint64(2**27)` (= 134,217,728)
13-
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
13+
PENDING_DEPOSITS_LIMIT: 134217728
1414
# `uint64(2**27)` (= 134,217,728)
1515
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728
1616
# `uint64(2**18)` (= 262,144)
@@ -43,3 +43,8 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
4343
# ---------------------------------------------------------------
4444
# 2**3 ( = 8) pending withdrawals
4545
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8
46+
47+
# Pending deposits processing
48+
# ---------------------------------------------------------------
49+
# 2**4 ( = 4) pending deposits
50+
MAX_PENDING_DEPOSITS_PER_EPOCH: 16

presets/minimal/electra.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
1010
# State list lengths
1111
# ---------------------------------------------------------------
1212
# `uint64(2**27)` (= 134,217,728)
13-
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
13+
PENDING_DEPOSITS_LIMIT: 134217728
1414
# [customized] `uint64(2**6)` (= 64)
1515
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
1616
# [customized] `uint64(2**6)` (= 64)
@@ -41,5 +41,10 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
4141

4242
# Withdrawals processing
4343
# ---------------------------------------------------------------
44-
# 2**0 ( = 1) pending withdrawals
45-
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1
44+
# 2**1 ( = 2) pending withdrawals
45+
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 2
46+
47+
# Pending deposits processing
48+
# ---------------------------------------------------------------
49+
# 2**4 ( = 4) pending deposits
50+
MAX_PENDING_DEPOSITS_PER_EPOCH: 16

pysetup/helpers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
119119
hardcoded_func_dep_presets = reduce(lambda obj, builder: {**obj, **builder.hardcoded_func_dep_presets(spec_object)}, builders, {})
120120
# Concatenate all strings
121121
imports = reduce(lambda txt, builder: (txt + "\n\n" + builder.imports(preset_name) ).strip("\n"), builders, "")
122+
classes = reduce(lambda txt, builder: (txt + "\n\n" + builder.classes() ).strip("\n"), builders, "")
122123
preparations = reduce(lambda txt, builder: (txt + "\n\n" + builder.preparations() ).strip("\n"), builders, "")
123124
sundry_functions = reduce(lambda txt, builder: (txt + "\n\n" + builder.sundry_functions() ).strip("\n"), builders, "")
124125
# Keep engine from the most recent fork
@@ -154,6 +155,8 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
154155
constant_vars_spec,
155156
preset_vars_spec,
156157
config_spec,
158+
# Custom classes which are not required to be SSZ containers.
159+
classes,
157160
ordered_class_objects_spec,
158161
protocols_spec,
159162
functions_spec,

pysetup/spec_builders/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ def imports(cls, preset_name: str) -> str:
1515
"""
1616
return ""
1717

18+
@classmethod
19+
def classes(cls) -> str:
20+
"""
21+
Define special classes.
22+
"""
23+
return ""
24+
1825
@classmethod
1926
def preparations(cls) -> str:
2027
"""

pysetup/spec_builders/deneb.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ def imports(cls, preset_name: str):
1212
from eth2spec.capella import {preset_name} as capella
1313
'''
1414

15+
@classmethod
16+
def classes(cls):
17+
return f'''
18+
class BLSFieldElement(bls.Scalar):
19+
pass
20+
21+
22+
class Polynomial(list):
23+
def __init__(self, evals: Optional[Sequence[BLSFieldElement]] = None):
24+
if evals is None:
25+
evals = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_BLOB
26+
if len(evals) != FIELD_ELEMENTS_PER_BLOB:
27+
raise ValueError("expected FIELD_ELEMENTS_PER_BLOB evals")
28+
super().__init__(evals)
29+
'''
1530

1631
@classmethod
1732
def preparations(cls):

pysetup/spec_builders/eip7594.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,41 @@ def imports(cls, preset_name: str):
1212
return f'''
1313
from eth2spec.deneb import {preset_name} as deneb
1414
'''
15-
15+
16+
17+
@classmethod
18+
def classes(cls):
19+
return f'''
20+
class PolynomialCoeff(list):
21+
def __init__(self, coeffs: Sequence[BLSFieldElement]):
22+
if len(coeffs) > FIELD_ELEMENTS_PER_EXT_BLOB:
23+
raise ValueError("expected <= FIELD_ELEMENTS_PER_EXT_BLOB coeffs")
24+
super().__init__(coeffs)
25+
26+
27+
class Coset(list):
28+
def __init__(self, coeffs: Optional[Sequence[BLSFieldElement]] = None):
29+
if coeffs is None:
30+
coeffs = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_CELL
31+
if len(coeffs) != FIELD_ELEMENTS_PER_CELL:
32+
raise ValueError("expected FIELD_ELEMENTS_PER_CELL coeffs")
33+
super().__init__(coeffs)
34+
35+
36+
class CosetEvals(list):
37+
def __init__(self, evals: Optional[Sequence[BLSFieldElement]] = None):
38+
if evals is None:
39+
evals = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_CELL
40+
if len(evals) != FIELD_ELEMENTS_PER_CELL:
41+
raise ValueError("expected FIELD_ELEMENTS_PER_CELL coeffs")
42+
super().__init__(evals)
43+
'''
1644

1745
@classmethod
1846
def sundry_functions(cls) -> str:
1947
return """
2048
def retrieve_column_sidecars(beacon_block_root: Root) -> Sequence[DataColumnSidecar]:
49+
# pylint: disable=unused-argument
2150
return []
2251
"""
2352

pysetup/spec_builders/electra.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ElectraSpecBuilder(BaseSpecBuilder):
1010
def imports(cls, preset_name: str):
1111
return f'''
1212
from eth2spec.deneb import {preset_name} as deneb
13+
from eth2spec.utils.ssz.ssz_impl import serialize
1314
'''
1415

1516
@classmethod
@@ -28,8 +29,8 @@ class NoopExecutionEngine(ExecutionEngine):
2829
2930
def notify_new_payload(self: ExecutionEngine,
3031
execution_payload: ExecutionPayload,
31-
execution_requests: ExecutionRequests,
32-
parent_beacon_block_root: Root) -> bool:
32+
parent_beacon_block_root: Root,
33+
execution_requests_list: list[bytes]) -> bool:
3334
return True
3435
3536
def notify_forkchoice_updated(self: ExecutionEngine,

0 commit comments

Comments
 (0)