Skip to content

Commit ee64f90

Browse files
committed
Merge branch 'dev' into eip-7495
2 parents a0712f1 + 6803ea3 commit ee64f90

File tree

157 files changed

+4737
-1163
lines changed

Some content is hidden

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

157 files changed

+4737
-1163
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ commands:
3535
description: "Restore the cache with pyspec keys"
3636
steps:
3737
- restore_cached_venv:
38-
venv_name: v30-pyspec
39-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}
38+
venv_name: v33-pyspec
39+
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}-{{ python3 --version }}
4040
save_pyspec_cached_venv:
4141
description: Save a venv into a cache with pyspec keys"
4242
steps:
4343
- save_cached_venv:
44-
venv_name: v30-pyspec
45-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}
44+
venv_name: v33-pyspec
45+
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}-{{ python3 --version }}
4646
venv_path: ./venv
4747
jobs:
4848
checkout_specs:
@@ -75,7 +75,7 @@ jobs:
7575
- restore_pyspec_cached_venv
7676
- run:
7777
name: Install pyspec requirements
78-
command: make eth2spec
78+
command: make pyspec
7979
- save_pyspec_cached_venv
8080
test-phase0:
8181
docker:

.github/workflows/generate_vectors.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717

1818
jobs:
1919
generate-tests:
20+
timeout-minutes: 720 # 12 hours
2021
runs-on: [self-hosted-ghr-custom, size-xl-x64, profile-consensusSpecs]
2122
steps:
2223
- name: Checkout repository
@@ -25,12 +26,6 @@ jobs:
2526
repository: 'ethereum/consensus-specs'
2627
path: 'consensus-specs'
2728
ref: ${{ inputs.ref || 'dev' }}
28-
- name: Checkout consensus-spec-tests repository
29-
uses: actions/checkout@v4
30-
with:
31-
repository: 'ethereum/consensus-spec-tests'
32-
path: 'consensus-spec-tests'
33-
fetch-depth: 1
3429
- name: Setup Python
3530
uses: actions/setup-python@v5
3631
with:
@@ -39,7 +34,7 @@ jobs:
3934
- name: Generate tests
4035
run: |
4136
cd consensus-specs
42-
make -j 16 gen_all 2>&1 | tee ../consensustestgen.log
37+
make -j$(nproc) gen_all 2>&1 | tee ../consensustestgen.log
4338
cp -r presets/ ../consensus-spec-tests/presets
4439
cp -r configs/ ../consensus-spec-tests/configs
4540
find . -type d -empty -delete
@@ -78,4 +73,4 @@ jobs:
7873
uses: actions/upload-artifact@v4
7974
with:
8075
name: consensustestgen.log
81-
path: consensustestgen.log
76+
path: consensustestgen.log

Makefile

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ ALL_EXECUTABLE_SPEC_NAMES = \
1616

1717
# A list of fake targets.
1818
.PHONY: \
19-
check_toc \
2019
clean \
2120
coverage \
2221
detect_errors \
23-
eth2spec \
2422
gen_all \
2523
gen_list \
2624
help \
@@ -39,11 +37,9 @@ NORM = $(shell tput sgr0)
3937

4038
# Print target descriptions.
4139
help:
42-
@echo "make $(BOLD)check_toc$(NORM) -- check table of contents"
4340
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
4441
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
4542
@echo "make $(BOLD)detect_errors$(NORM) -- detect generator errors"
46-
@echo "make $(BOLD)eth2spec$(NORM) -- force rebuild eth2spec package"
4743
@echo "make $(BOLD)gen_<gen>$(NORM) -- run a single generator"
4844
@echo "make $(BOLD)gen_all$(NORM) -- run all generators"
4945
@echo "make $(BOLD)gen_list$(NORM) -- list all generator targets"
@@ -62,33 +58,23 @@ PYTHON_VENV = $(VENV)/bin/python3
6258
PIP_VENV = $(VENV)/bin/pip3
6359
CODESPELL_VENV = $(VENV)/bin/codespell
6460

65-
# Make a virtual environment will all of the necessary dependencies.
66-
$(VENV): requirements_preinstallation.txt
61+
# Make a virtual environment.
62+
$(VENV):
6763
@echo "Creating virtual environment"
6864
@python3 -m venv $(VENV)
69-
@$(PIP_VENV) install -r requirements_preinstallation.txt
65+
@$(PIP_VENV) install --quiet uv==0.5.24
7066

7167
###############################################################################
7268
# Specification
7369
###############################################################################
7470

7571
TEST_LIBS_DIR = $(CURDIR)/tests/core
7672
PYSPEC_DIR = $(TEST_LIBS_DIR)/pyspec
77-
SITE_PACKAGES := $(wildcard $(VENV)/lib/python*/site-packages)
78-
ETH2SPEC := $(SITE_PACKAGES)/eth2spec
79-
80-
# Install the eth2spec package.
81-
# The pipe indicates that venv is an order-only prerequisite.
82-
# When restoring venv cache, its timestamp is newer than eth2spec.
83-
$(ETH2SPEC): setup.py | $(VENV)
84-
@$(PIP_VENV) install .[docs,lint,test,generator]
85-
86-
# Force rebuild/install the eth2spec package.
87-
eth2spec:
88-
$(MAKE) --always-make $(ETH2SPEC)
8973

9074
# Create the pyspec for all phases.
91-
pyspec: $(VENV) setup.py
75+
pyspec: $(VENV) setup.py pyproject.toml
76+
@echo "Building eth2spec"
77+
@$(PYTHON_VENV) -m uv pip install --reinstall-package=eth2spec .[docs,lint,test,generator]
9278
@echo "Building all pyspecs"
9379
@$(PYTHON_VENV) setup.py pyspecdev
9480

@@ -99,6 +85,8 @@ pyspec: $(VENV) setup.py
9985
TEST_REPORT_DIR = $(PYSPEC_DIR)/test-reports
10086

10187
# Run pyspec tests.
88+
# Note: for debugging output to show, print to stderr.
89+
#
10290
# To run a specific test, append k=<test>, eg:
10391
# make test k=test_verify_kzg_proof
10492
# To run tests for a specific fork, append fork=<fork>, eg:
@@ -113,10 +101,11 @@ test: MAYBE_TEST := $(if $(k),-k=$(k))
113101
test: MAYBE_FORK := $(if $(fork),--fork=$(fork))
114102
test: PRESET := --preset=$(if $(preset),$(preset),minimal)
115103
test: BLS := --bls-type=$(if $(bls),$(bls),fastest)
116-
test: $(ETH2SPEC) pyspec
104+
test: pyspec
117105
@mkdir -p $(TEST_REPORT_DIR)
118106
@$(PYTHON_VENV) -m pytest \
119107
-n auto \
108+
--capture=no \
120109
$(MAYBE_TEST) \
121110
$(MAYBE_FORK) \
122111
$(PRESET) \
@@ -136,7 +125,7 @@ COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), --cov=eth2spec.$S.$(
136125
# Run pytest with coverage tracking
137126
_test_with_coverage: MAYBE_TEST := $(if $(k),-k=$(k))
138127
_test_with_coverage: MAYBE_FORK := $(if $(fork),--fork=$(fork))
139-
_test_with_coverage: $(ETH2SPEC) pyspec
128+
_test_with_coverage: pyspec
140129
@$(PYTHON_VENV) -m pytest \
141130
-n auto \
142131
$(MAYBE_TEST) \
@@ -193,10 +182,6 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/*/*.md) \
193182
$(wildcard $(SPEC_DIR)/_features/*/*/*.md) \
194183
$(wildcard $(SSZ_DIR)/*.md)
195184

196-
# Check all files and error if any ToC were modified.
197-
check_toc: $(MARKDOWN_FILES:=.toc)
198-
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0
199-
200185
# Generate ToC sections & save copy of original if modified.
201186
%.toc:
202187
@cp $* $*.tmp; \
@@ -209,8 +194,12 @@ check_toc: $(MARKDOWN_FILES:=.toc)
209194
echo "\033[1;34m See $*.tmp\033[0m"; \
210195
fi
211196

197+
# Check all files and error if any ToC were modified.
198+
_check_toc: $(MARKDOWN_FILES:=.toc)
199+
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0
200+
212201
# Check for mistakes.
213-
lint: $(ETH2SPEC) pyspec check_toc
202+
lint: pyspec _check_toc
214203
@$(CODESPELL_VENV) . --skip "./.git,$(VENV),$(PYSPEC_DIR)/.mypy_cache" -I .codespell-whitelist
215204
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(PYSPEC_DIR)/eth2spec
216205
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(TEST_GENERATORS_DIR)
@@ -235,17 +224,19 @@ gen_list:
235224
done
236225

237226
# Run one generator.
227+
# This will forcibly rebuild pyspec just in case.
238228
# To check modules for a generator, append modcheck=true, eg:
239229
# make gen_genesis modcheck=true
240230
gen_%: MAYBE_MODCHECK := $(if $(filter true,$(modcheck)),--modcheck)
241-
gen_%: $(ETH2SPEC) pyspec
231+
gen_%: pyspec
242232
@mkdir -p $(TEST_VECTOR_DIR)
243233
@$(PYTHON_VENV) $(GENERATOR_DIR)/$*/main.py \
244234
--output $(TEST_VECTOR_DIR) \
245235
$(MAYBE_MODCHECK)
246236

247237
# Run all generators then check for errors.
248-
gen_all: $(GENERATOR_TARGETS) detect_errors
238+
gen_all: $(GENERATOR_TARGETS)
239+
@$(MAKE) detect_errors
249240

250241
# Detect errors in generators.
251242
detect_errors: $(TEST_VECTOR_DIR)
@@ -257,7 +248,7 @@ detect_errors: $(TEST_VECTOR_DIR)
257248
fi
258249

259250
# Generate KZG trusted setups for testing.
260-
kzg_setups: $(ETH2SPEC)
251+
kzg_setups: pyspec
261252
@for preset in minimal mainnet; do \
262253
$(PYTHON_VENV) $(SCRIPTS_DIR)/gen_kzg_trusted_setups.py \
263254
--secret=1337 \

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ To learn more about proof-of-stake and sharding, see the [PoS documentation](htt
66

77
This repository hosts the current Ethereum proof-of-stake specifications. Discussions about design rationale and proposed changes can be brought up and discussed as issues. Solidified, agreed-upon changes to the spec can be made through pull requests.
88

9-
## Specs
9+
## Specifications
1010

1111
[![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

13-
Core specifications for Ethereum proof-of-stake clients can be found in [specs](./specs). These are divided into features.
13+
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.
1515

1616
### Stable Specifications
@@ -30,14 +30,6 @@ Features are researched and developed in parallel, and then consolidated into se
3030
| 5 | **Electra** | TBD | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/electra/beacon-chain.md)</li><li>[Electra fork](specs/electra/fork.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/electra/light-client/sync-protocol.md) ([fork](specs/electra/light-client/fork.md), [networking](specs/electra/light-client/p2p-interface.md))</li><li>[Honest validator guide changes](specs/electra/validator.md)</li><li>[P2P networking](specs/electra/p2p-interface.md)</li></ul></ul> |
3131
| 6 | **Fulu** | TBD | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/fulu/beacon-chain.md)</li><li>[Fulu fork](specs/fulu/fork.md)</li><li>[Data availability sampling core](specs/fulu/das-core.md)</li><li>[Polynomial commitments sampling](specs/fulu/polynomial-commitments-sampling.md)</li><li>[Fork choice changes](specs/fulu/fork-choice.md)</li></ul><li>Additions</li><ul><li>[P2P networking](specs/fulu/p2p-interface.md)</li><li>[Peer sampling](specs/fulu/peer-sampling.md)</li></ul></ul> |
3232

33-
### Outdated Specifications
34-
35-
| Code Name or Topic | Specs | Notes |
36-
| - | - | - |
37-
| Sharding | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/sharding/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[P2P networking](specs/_features/sharding/p2p-interface.md)</li></ul></ul> |
38-
| Custody Game | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/custody_game/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/_features/custody_game/validator.md)</li></ul></ul> | Dependent on sharding |
39-
| Data Availability Sampling | <ul><li>Core</li><ul><li>[Core types and functions](specs/_features/das/das-core.md)</li><li>[Fork choice changes](specs/_features/das/fork-choice.md)</li></ul><li>Additions</li><ul><li>[P2P Networking](specs/_features/das/p2p-interface.md)</li><li>[Sampling process](specs/_features/das/sampling.md)</li></ul></ul> | <ul><li> Dependent on sharding</li><li>[Technical explainer](https://hackmd.io/@HWeNw8hNRimMm2m2GH56Cw/B1YJPGkpD)</li></ul> |
40-
4133
### Accompanying documents can be found in [specs](specs) and include:
4234

4335
* [SimpleSerialize (SSZ) spec](ssz/simple-serialize.md)
@@ -50,7 +42,7 @@ Additional specifications and standards outside of requisite client functionalit
5042

5143
* [Beacon APIs](https://github.com/ethereum/beacon-apis)
5244
* [Engine APIs](https://github.com/ethereum/execution-apis/tree/main/src/engine)
53-
* [Beacon Metrics](https://github.com/ethereum/beacon-metrics/)
45+
* [Beacon Metrics](https://github.com/ethereum/beacon-metrics)
5446

5547
## Design goals
5648

@@ -81,8 +73,8 @@ Documentation on the different components used during spec writing can be found
8173

8274
Conformance tests built from the executable python spec are available in the [Ethereum Proof-of-Stake Consensus Spec Tests](https://github.com/ethereum/consensus-spec-tests) repo. Compressed tarballs are available in [releases](https://github.com/ethereum/consensus-spec-tests/releases).
8375

76+
## Installation and usage
8477

85-
## Installation and Usage
8678
The consensus-specs repo can be used by running the tests locally or inside a docker container.
8779

8880
To run the tests locally:

configs/mainnet.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,13 @@ DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cBB839Cbe05303d7705Fa
115115
# Networking
116116
# ---------------------------------------------------------------
117117
# `10 * 2**20` (= 10485760, 10 MiB)
118-
GOSSIP_MAX_SIZE: 10485760
118+
MAX_PAYLOAD_SIZE: 10485760
119119
# `2**10` (= 1024)
120120
MAX_REQUEST_BLOCKS: 1024
121121
# `2**8` (= 256)
122122
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
123123
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
124124
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
125-
# `10 * 2**20` (=10485760, 10 MiB)
126-
MAX_CHUNK_SIZE: 10485760
127125
# 5s
128126
TTFB_TIMEOUT: 5
129127
# 10s
@@ -172,9 +170,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
172170
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
173171
SAMPLES_PER_SLOT: 8
174172
CUSTODY_REQUIREMENT: 4
173+
VALIDATOR_CUSTODY_REQUIREMENT: 8
174+
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
175175
MAX_BLOBS_PER_BLOCK_FULU: 12
176-
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU`
177-
MAX_REQUEST_BLOB_SIDECARS_FULU: 1536
176+
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
178177

179178
# Whisk
180179
# `Epoch(2**8)`

configs/minimal.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,13 @@ DEPOSIT_CONTRACT_ADDRESS: 0x1234567890123456789012345678901234567890
116116
# Networking
117117
# ---------------------------------------------------------------
118118
# `10 * 2**20` (= 10485760, 10 MiB)
119-
GOSSIP_MAX_SIZE: 10485760
119+
MAX_PAYLOAD_SIZE: 10485760
120120
# `2**10` (= 1024)
121121
MAX_REQUEST_BLOCKS: 1024
122122
# `2**8` (= 256)
123123
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
124124
# [customized] `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 272)
125125
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 272
126-
# `10 * 2**20` (=10485760, 10 MiB)
127-
MAX_CHUNK_SIZE: 10485760
128126
# 5s
129127
TTFB_TIMEOUT: 5
130128
# 10s
@@ -173,9 +171,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
173171
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
174172
SAMPLES_PER_SLOT: 8
175173
CUSTODY_REQUIREMENT: 4
174+
VALIDATOR_CUSTODY_REQUIREMENT: 8
175+
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
176176
MAX_BLOBS_PER_BLOCK_FULU: 12
177-
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU`
178-
MAX_REQUEST_BLOB_SIDECARS_FULU: 1536
177+
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
179178

180179
# Whisk
181180
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4

docker/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
## Docker related information
22

33
This dockerfile sets up the dependencies required to run consensus-spec tests. The docker image can be locally built with:
4-
- `docker build ./ -t $IMAGE_NAME -f ./docker/Dockerfile`
54

5+
- `docker build ./ -t $IMAGE_NAME -f ./docker/Dockerfile`
66

77
Handy commands:
8+
89
- `docker run -it $IMAGE_NAME /bin/sh` will give you a shell inside the docker container to manually run any tests
910
- `docker run $IMAGE_NAME make test` will run the make test command inside the docker container
1011

1112
Ideally manual running of docker containers is for advanced users, we recommend the script based approach described below for most users.
1213

13-
The `scripts/build_run_docker_tests.sh` script will cover most usecases. The script allows the user to configure the fork(altair/bellatrix/capella..), `$IMAGE_NAME` (specifies the container to use), preset type (mainnet/minimal), and test all forks flags. Ideally, this is the main way that users interact with the spec tests instead of running it locally with varying versions of dependencies.
14+
The `scripts/build_run_docker_tests.sh` script will cover most use cases. The script allows the user to configure the fork(altair/bellatrix/capella..), `$IMAGE_NAME` (specifies the container to use), preset type (mainnet/minimal), and test all forks flags. Ideally, this is the main way that users interact with the spec tests instead of running it locally with varying versions of dependencies.
1415

1516
E.g:
17+
1618
- `./build_run_docker_tests.sh --p mainnet` will run the mainnet preset tests
1719
- `./build_run_docker_tests.sh --a` will run all the tests across all the forks
1820
- `./build_run_docker_tests.sh --f deneb` will only run deneb tests

0 commit comments

Comments
 (0)