Skip to content

Commit e5b8b00

Browse files
committed
Merge branch 'dev' into eip-7495
2 parents ec64491 + 148ccca commit e5b8b00

File tree

94 files changed

+2239
-606
lines changed

Some content is hidden

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

94 files changed

+2239
-606
lines changed

.circleci/config.yml

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ commands:
4444
venv_name: v25-pyspec
4545
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}
4646
venv_path: ./venv
47-
restore_deposit_contract_tester_cached_venv:
48-
description: "Restore the venv from cache for the deposit contract tester"
49-
steps:
50-
- restore_cached_venv:
51-
venv_name: v23-deposit-contract-tester
52-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
53-
save_deposit_contract_tester_cached_venv:
54-
description: "Save the venv to cache for later use of the deposit contract tester"
55-
steps:
56-
- save_cached_venv:
57-
venv_name: v23-deposit-contract-tester
58-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
59-
venv_path: ./solidity_deposit_contract/web3_tester/venv
6047
jobs:
6148
checkout_specs:
6249
docker:
@@ -226,71 +213,6 @@ jobs:
226213
- run:
227214
name: Run linter for test generators
228215
command: make lint_generators
229-
build_deposit_contract:
230-
docker:
231-
- image: ethereum/solc:0.6.11-alpine
232-
steps:
233-
- checkout
234-
- run:
235-
name: Install build essentials
236-
command: |
237-
apk update
238-
apk add git make
239-
- run:
240-
name: Compile the contract
241-
command: |
242-
make compile_deposit_contract
243-
git diff --color --exit-code
244-
- persist_to_workspace:
245-
root: .
246-
paths:
247-
- ./solidity_deposit_contract/deposit_contract.json
248-
- ./build/combined.json
249-
- ./solidity_deposit_contract/lib
250-
test_deposit_contract:
251-
docker:
252-
- image: nixorg/nix:circleci
253-
steps:
254-
- checkout
255-
- restore_cache:
256-
key: nix-store-test-v2
257-
- attach_workspace:
258-
at: /tmp/
259-
- run:
260-
name: Test the contract
261-
command: |
262-
mkdir build
263-
cp -r /tmp/build/* build
264-
cp -r /tmp/solidity_deposit_contract/lib/* ./solidity_deposit_contract/lib
265-
cp -r /tmp/solidity_deposit_contract/deposit_contract.json ./solidity_deposit_contract/deposit_contract.json
266-
nix-shell --command 'make test_deposit_contract' ./solidity_deposit_contract/shell.nix
267-
- save_cache:
268-
key: nix-store-test-v2
269-
paths:
270-
- /nix
271-
install_deposit_contract_web3_tester:
272-
docker:
273-
- image: cimg/python:3.12.4
274-
working_directory: ~/specs-repo
275-
steps:
276-
- restore_cache:
277-
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
278-
- restore_deposit_contract_tester_cached_venv
279-
- run:
280-
name: Install deposit contract tester requirements
281-
command: make install_deposit_contract_web3_tester
282-
- save_deposit_contract_tester_cached_venv
283-
test_deposit_contract_web3_tests:
284-
docker:
285-
- image: cimg/python:3.12.4
286-
working_directory: ~/specs-repo
287-
steps:
288-
- restore_cache:
289-
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
290-
- restore_deposit_contract_tester_cached_venv
291-
- run:
292-
name: Run deposit contract test with web3.py
293-
command: make test_deposit_contract_web3_tests
294216
workflows:
295217
version: 2.1
296218
test_spec:
@@ -328,17 +250,3 @@ workflows:
328250
- lint:
329251
requires:
330252
- install_pyspec_test
331-
# NOTE: Since phase 0 has been launched, we disabled the deposit contract tests.
332-
# - install_deposit_contract_web3_tester:
333-
# requires:
334-
# - checkout_specs
335-
# - test_deposit_contract_web3_tests:
336-
# requires:
337-
# - install_deposit_contract_web3_tester
338-
build_and_test_deposit_contract:
339-
jobs:
340-
- build_deposit_contract
341-
# NOTE: Since phase 0 has been launched, we disabled the deposit contract tests.
342-
# - test_deposit_contract:
343-
# requires:
344-
# - build_deposit_contract

.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 & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ ETH2SPEC_MODULE_DIR = $(PY_SPEC_DIR)/eth2spec
88
TEST_REPORT_DIR = $(PY_SPEC_DIR)/test-reports
99
TEST_VECTOR_DIR = ../consensus-spec-tests/tests
1010
GENERATOR_DIR = ./tests/generators
11-
SOLIDITY_DEPOSIT_CONTRACT_DIR = ./solidity_deposit_contract
12-
SOLIDITY_DEPOSIT_CONTRACT_SOURCE = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/deposit_contract.sol
13-
SOLIDITY_FILE_NAME = deposit_contract.json
14-
DEPOSIT_CONTRACT_TESTER_DIR = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/web3_tester
1511
CONFIGS_DIR = ./configs
1612
TEST_PRESET_TYPE ?= minimal
1713
# Collect a list of generator names
@@ -45,20 +41,12 @@ COV_HTML_OUT_DIR=$(PY_SPEC_DIR)/$(COV_HTML_OUT)
4541
COV_INDEX_FILE=$(COV_HTML_OUT_DIR)/index.html
4642

4743
CURRENT_DIR = ${CURDIR}
48-
LINTER_CONFIG_FILE = $(CURRENT_DIR)/linter.ini
4944
GENERATOR_ERROR_LOG_FILE = $(CURRENT_DIR)/$(TEST_VECTOR_DIR)/testgen_error_log.txt
5045

5146
SCRIPTS_DIR = ${CURRENT_DIR}/scripts
5247

53-
export DAPP_SKIP_BUILD:=1
54-
export DAPP_SRC:=$(SOLIDITY_DEPOSIT_CONTRACT_DIR)
55-
export DAPP_LIB:=$(SOLIDITY_DEPOSIT_CONTRACT_DIR)/lib
56-
export DAPP_JSON:=build/combined.json
57-
5848
.PHONY: clean partial_clean all test citest lint generate_tests pyspec install_test open_cov \
59-
install_deposit_contract_tester test_deposit_contract install_deposit_contract_compiler \
60-
compile_deposit_contract test_compile_deposit_contract check_toc \
61-
detect_generator_incomplete detect_generator_error_log
49+
check_toc detect_generator_incomplete detect_generator_error_log
6250

6351
all: $(PY_SPEC_ALL_TARGETS)
6452

@@ -162,33 +150,16 @@ codespell:
162150

163151
lint: pyspec
164152
. venv/bin/activate; cd $(PY_SPEC_DIR); \
165-
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
166-
&& python -m pylint --rcfile $(LINTER_CONFIG_FILE) $(PYLINT_SCOPE) \
167-
&& 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)
168156

169157
lint_generators: pyspec
170158
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
171-
flake8 --config $(LINTER_CONFIG_FILE)
172-
173-
compile_deposit_contract:
174-
@cd $(SOLIDITY_DEPOSIT_CONTRACT_DIR)
175-
@git submodule update --recursive --init
176-
@solc --metadata-literal --optimize --optimize-runs 5000000 --bin --abi --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast,metadata,storage-layout --overwrite -o build $(SOLIDITY_DEPOSIT_CONTRACT_SOURCE) $(SOLIDITY_DEPOSIT_CONTRACT_DIR)/tests/deposit_contract.t.sol
177-
@/bin/echo -n '{"abi": ' > $(SOLIDITY_FILE_NAME)
178-
@cat build/DepositContract.abi >> $(SOLIDITY_FILE_NAME)
179-
@/bin/echo -n ', "bytecode": "0x' >> $(SOLIDITY_FILE_NAME)
180-
@cat build/DepositContract.bin >> $(SOLIDITY_FILE_NAME)
181-
@/bin/echo -n '"}' >> $(SOLIDITY_FILE_NAME)
182-
183-
test_deposit_contract:
184-
dapp test -v --fuzz-runs 5
185-
186-
install_deposit_contract_web3_tester:
187-
cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; python3 -m pip install -r requirements.txt
159+
flake8 --config $(CURRENT_DIR)/flake8.ini
188160

189-
test_deposit_contract_web3_tests:
190-
cd $(DEPOSIT_CONTRACT_TESTER_DIR); . venv/bin/activate; \
191-
python3 -m pytest .
161+
# If set to true, it will not run generator tests.
162+
modcheck ?= false
192163

193164
# Runs a generator, identified by param 1
194165
define run_generator
@@ -208,7 +179,7 @@ define run_generator
208179
. venv/bin/activate; \
209180
pip3 install ../../../dist/eth2spec-*.whl; \
210181
pip3 install 'eth2spec[generator]'; \
211-
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR); \
182+
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR) $(if $(filter true,$(modcheck)),--modcheck); \
212183
echo "generator $(1) finished"
213184
endef
214185

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This repository hosts the current Ethereum proof-of-stake specifications. Discus
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
@@ -20,16 +20,22 @@ Features are researched and developed in parallel, and then consolidated into se
2020
| 0 | **Phase0** |`0` | <ul><li>Core</li><ul><li>[The beacon chain](specs/phase0/beacon-chain.md)</li><li>[Deposit contract](specs/phase0/deposit-contract.md)</li><li>[Beacon chain fork choice](specs/phase0/fork-choice.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide](specs/phase0/validator.md)</li><li>[P2P networking](specs/phase0/p2p-interface.md)</li><li>[Weak subjectivity](specs/phase0/weak-subjectivity.md)</li></ul></ul> |
2121
| 1 | **Altair** | `74240` | <ul><li>Core</li><ul><li>[Beacon chain changes](specs/altair/beacon-chain.md)</li><li>[Altair fork](specs/altair/fork.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol](specs/altair/light-client/sync-protocol.md) ([full node](specs/altair/light-client/full-node.md), [light client](specs/altair/light-client/light-client.md), [networking](specs/altair/light-client/p2p-interface.md))</li><li>[Honest validator guide changes](specs/altair/validator.md)</li><li>[P2P networking](specs/altair/p2p-interface.md)</li></ul></ul> |
2222
| 2 | **Bellatrix** <br/> (["The Merge"](https://ethereum.org/en/upgrades/merge/)) | `144896` | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/bellatrix/beacon-chain.md)</li><li>[Bellatrix fork](specs/bellatrix/fork.md)</li><li>[Fork choice changes](specs/bellatrix/fork-choice.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/bellatrix/validator.md)</li><li>[P2P networking](specs/bellatrix/p2p-interface.md)</li></ul></ul> |
23-
| 3 | **Capella** | `194048` | <ul><li>Core</li><ul><li>[Beacon chain changes](specs/capella/beacon-chain.md)</li><li>[Capella fork](specs/capella/fork.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/capella/light-client/sync-protocol.md) ([fork](specs/capella/light-client/fork.md), [full node](specs/capella/light-client/full-node.md), [networking](specs/capella/light-client/p2p-interface.md))</li></ul><ul><li>[Validator additions](specs/capella/validator.md)</li><li>[P2P networking](specs/capella/p2p-interface.md)</li></ul></ul> |
24-
| 4 | **Deneb** | `269568` | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/deneb/beacon-chain.md)</li><li>[Deneb fork](specs/deneb/fork.md)</li><li>[Polynomial commitments](specs/deneb/polynomial-commitments.md)</li><li>[Fork choice changes](specs/deneb/fork-choice.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/deneb/light-client/sync-protocol.md) ([fork](specs/deneb/light-client/fork.md), [full node](specs/deneb/light-client/full-node.md), [networking](specs/deneb/light-client/p2p-interface.md))</li></ul><ul><li>[Honest validator guide changes](specs/deneb/validator.md)</li><li>[P2P networking](specs/deneb/p2p-interface.md)</li></ul></ul> |
23+
| 3 | **Capella** | `194048` | <ul><li>Core</li><ul><li>[Beacon chain changes](specs/capella/beacon-chain.md)</li><li>[Capella fork](specs/capella/fork.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/capella/light-client/sync-protocol.md) ([fork](specs/capella/light-client/fork.md), [full node](specs/capella/light-client/full-node.md), [networking](specs/capella/light-client/p2p-interface.md))</li><li>[Validator additions](specs/capella/validator.md)</li><li>[P2P networking](specs/capella/p2p-interface.md)</li></ul></ul> |
24+
| 4 | **Deneb** | `269568` | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/deneb/beacon-chain.md)</li><li>[Deneb fork](specs/deneb/fork.md)</li><li>[Polynomial commitments](specs/deneb/polynomial-commitments.md)</li><li>[Fork choice changes](specs/deneb/fork-choice.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/deneb/light-client/sync-protocol.md) ([fork](specs/deneb/light-client/fork.md), [full node](specs/deneb/light-client/full-node.md), [networking](specs/deneb/light-client/p2p-interface.md))</li><li>[Honest validator guide changes](specs/deneb/validator.md)</li><li>[P2P networking](specs/deneb/p2p-interface.md)</li></ul></ul> |
2525

2626
### In-development Specifications
27+
28+
| Seq. | Code Name | Fork Epoch | Specs |
29+
| - | - | - | - |
30+
| 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> |
31+
32+
### Outdated Specifications
33+
2734
| Code Name or Topic | Specs | Notes |
2835
| - | - | - |
29-
| Electra | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/electra/beacon-chain.md)</li><li>[EIP-6110 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), [full node](specs/electra/light-client/full-node.md), [networking](specs/electra/light-client/p2p-interface.md))</li></ul><ul><li>[Honest validator guide changes](specs/electra/validator.md)</li></ul></ul> |
30-
| Sharding (outdated) | <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> |
31-
| Custody Game (outdated) | <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 |
32-
| Data Availability Sampling (outdated) | <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> |
36+
| 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> |
37+
| 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 |
38+
| 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> |
3339

3440
### Accompanying documents can be found in [specs](specs) and include:
3541

configs/mainnet.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
165165
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
166166
SAMPLES_PER_SLOT: 8
167167
CUSTODY_REQUIREMENT: 4
168+
BLOB_SIDECAR_SUBNET_COUNT_EIP7594: 8
169+
MAX_BLOBS_PER_BLOCK_EIP7594: 8
170+
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_EIP7594`
171+
MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1024
168172

169173
# [New in Electra:EIP7251]
170174
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)

configs/minimal.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
164164
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
165165
SAMPLES_PER_SLOT: 8
166166
CUSTODY_REQUIREMENT: 4
167+
BLOB_SIDECAR_SUBNET_COUNT_EIP7594: 8
168+
MAX_BLOBS_PER_BLOCK_EIP7594: 8
169+
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_EIP7594`
170+
MAX_REQUEST_BLOB_SIDECARS_EIP7594: 1024
167171

168172
# [New in Electra:EIP7251]
169173
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)

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

0 commit comments

Comments
 (0)