Skip to content

Commit 30ecf2c

Browse files
authored
Merge pull request #3954 from ethereum/dev
Release v1.5.0-alpha.7
2 parents cb03c85 + 7df1ce3 commit 30ecf2c

File tree

55 files changed

+2809
-1138
lines changed

Some content is hidden

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

55 files changed

+2809
-1138
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

setup.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
)
3636
from pysetup.md_doc_paths import get_md_doc_paths
3737

38+
# Ignore '1.5.0-alpha.*' to '1.5.0a*' messages.
39+
import warnings
40+
warnings.filterwarnings('ignore', message='Normalizing .* to .*')
41+
42+
# Ignore 'running' and 'creating' messages
43+
import logging
44+
class PyspecFilter(logging.Filter):
45+
def filter(self, record):
46+
return not record.getMessage().startswith(('running ', 'creating '))
47+
logging.getLogger().addFilter(PyspecFilter())
3848

3949
# NOTE: have to programmatically include third-party dependencies in `setup.py`.
4050
def installPackage(package: str):
@@ -173,7 +183,7 @@ def _update_constant_vars_with_kzg_setups(constant_vars, preset_name):
173183
constant_vars['KZG_SETUP_G1_MONOMIAL'] = VariableDefinition(constant_vars['KZG_SETUP_G1_MONOMIAL'].value, str(kzg_setups[0]), comment, None)
174184
constant_vars['KZG_SETUP_G1_LAGRANGE'] = VariableDefinition(constant_vars['KZG_SETUP_G1_LAGRANGE'].value, str(kzg_setups[1]), comment, None)
175185
constant_vars['KZG_SETUP_G2_MONOMIAL'] = VariableDefinition(constant_vars['KZG_SETUP_G2_MONOMIAL'].value, str(kzg_setups[2]), comment, None)
176-
186+
177187

178188
def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], preset_name=str) -> SpecObject:
179189
functions: Dict[str, str] = {}
@@ -251,10 +261,17 @@ def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], pr
251261
# marko parses `**X**` as a list containing a X
252262
description = description[0].children
253263

264+
if isinstance(name, list):
265+
# marko parses `[X]()` as a list containing a X
266+
name = name[0].children
254267
if isinstance(value, list):
255268
# marko parses `**X**` as a list containing a X
256269
value = value[0].children
257270

271+
# Skip types that have been defined elsewhere
272+
if description is not None and description.startswith("<!-- predefined-type -->"):
273+
continue
274+
258275
if not _is_constant_id(name):
259276
# Check for short type declarations
260277
if value.startswith(("uint", "Bytes", "ByteList", "Union", "Vector", "List", "ByteVector")):
@@ -394,8 +411,6 @@ def initialize_options(self):
394411
def finalize_options(self):
395412
"""Post-process options."""
396413
if len(self.md_doc_paths) == 0:
397-
print("no paths were specified, using default markdown file paths for pyspec"
398-
" build (spec fork: %s)" % self.spec_fork)
399414
self.md_doc_paths = get_md_doc_paths(self.spec_fork)
400415
if len(self.md_doc_paths) == 0:
401416
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
@@ -428,6 +443,7 @@ def run(self):
428443
if not self.dry_run:
429444
dir_util.mkpath(self.out_dir)
430445

446+
print(f'Building pyspec: {self.spec_fork}')
431447
for (name, preset_paths, config_path) in self.parsed_build_targets:
432448
spec_str = build_spec(
433449
spec_builders[self.spec_fork].fork,
@@ -492,7 +508,6 @@ def run_pyspec_cmd(self, spec_fork: str, **opts):
492508
self.run_command('pyspec')
493509

494510
def run(self):
495-
print("running build_py command")
496511
for spec_fork in spec_builders:
497512
self.run_pyspec_cmd(spec_fork=spec_fork)
498513

@@ -561,7 +576,7 @@ def run(self):
561576
RUAMEL_YAML_VERSION,
562577
"lru-dict==1.2.0",
563578
MARKO_VERSION,
564-
"py_arkworks_bls12381==0.3.4",
565-
"curdleproofs==0.1.1",
579+
"py_arkworks_bls12381==0.3.8",
580+
"curdleproofs==0.1.2",
566581
]
567582
)

0 commit comments

Comments
 (0)