Skip to content

Commit 385efd7

Browse files
authored
Merge pull request #4097 from ethereum/dev
Release v1.5.0-beta.1
2 parents 9a0b3ef + f17311c commit 385efd7

File tree

94 files changed

+928
-406
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

+928
-406
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: v32-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" }}
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: v32-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" }}
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:

Makefile

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ALL_EXECUTABLE_SPEC_NAMES = \
1919
clean \
2020
coverage \
2121
detect_errors \
22-
eth2spec \
2322
gen_all \
2423
gen_list \
2524
help \
@@ -41,7 +40,6 @@ help:
4140
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
4241
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
4342
@echo "make $(BOLD)detect_errors$(NORM) -- detect generator errors"
44-
@echo "make $(BOLD)eth2spec$(NORM) -- force rebuild eth2spec package"
4543
@echo "make $(BOLD)gen_<gen>$(NORM) -- run a single generator"
4644
@echo "make $(BOLD)gen_all$(NORM) -- run all generators"
4745
@echo "make $(BOLD)gen_list$(NORM) -- list all generator targets"
@@ -60,33 +58,23 @@ PYTHON_VENV = $(VENV)/bin/python3
6058
PIP_VENV = $(VENV)/bin/pip3
6159
CODESPELL_VENV = $(VENV)/bin/codespell
6260

63-
# Make a virtual environment will all of the necessary dependencies.
64-
$(VENV): requirements_preinstallation.txt
61+
# Make a virtual environment.
62+
$(VENV):
6563
@echo "Creating virtual environment"
6664
@python3 -m venv $(VENV)
67-
@$(PIP_VENV) install -r requirements_preinstallation.txt
65+
@$(PIP_VENV) install --quiet uv==0.5.24
6866

6967
###############################################################################
7068
# Specification
7169
###############################################################################
7270

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

8874
# Create the pyspec for all phases.
89-
pyspec: $(VENV) setup.py
75+
pyspec: $(VENV) setup.py pyproject.toml
76+
@echo "Building eth2spec"
77+
@$(PYTHON_VENV) -m uv pip install .[docs,lint,test,generator]
9078
@echo "Building all pyspecs"
9179
@$(PYTHON_VENV) setup.py pyspecdev
9280

@@ -113,7 +101,7 @@ 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 \
@@ -137,7 +125,7 @@ COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), --cov=eth2spec.$S.$(
137125
# Run pytest with coverage tracking
138126
_test_with_coverage: MAYBE_TEST := $(if $(k),-k=$(k))
139127
_test_with_coverage: MAYBE_FORK := $(if $(fork),--fork=$(fork))
140-
_test_with_coverage: $(ETH2SPEC) pyspec
128+
_test_with_coverage: pyspec
141129
@$(PYTHON_VENV) -m pytest \
142130
-n auto \
143131
$(MAYBE_TEST) \
@@ -211,7 +199,7 @@ _check_toc: $(MARKDOWN_FILES:=.toc)
211199
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0
212200

213201
# Check for mistakes.
214-
lint: $(ETH2SPEC) pyspec _check_toc
202+
lint: pyspec _check_toc
215203
@$(CODESPELL_VENV) . --skip "./.git,$(VENV),$(PYSPEC_DIR)/.mypy_cache" -I .codespell-whitelist
216204
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(PYSPEC_DIR)/eth2spec
217205
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(TEST_GENERATORS_DIR)
@@ -236,11 +224,11 @@ gen_list:
236224
done
237225

238226
# Run one generator.
239-
# This will forcibly rebuild eth2spec just in case.
227+
# This will forcibly rebuild pyspec just in case.
240228
# To check modules for a generator, append modcheck=true, eg:
241229
# make gen_genesis modcheck=true
242230
gen_%: MAYBE_MODCHECK := $(if $(filter true,$(modcheck)),--modcheck)
243-
gen_%: eth2spec
231+
gen_%: pyspec
244232
@mkdir -p $(TEST_VECTOR_DIR)
245233
@$(PYTHON_VENV) $(GENERATOR_DIR)/$*/main.py \
246234
--output $(TEST_VECTOR_DIR) \
@@ -260,7 +248,7 @@ detect_errors: $(TEST_VECTOR_DIR)
260248
fi
261249

262250
# Generate KZG trusted setups for testing.
263-
kzg_setups: $(ETH2SPEC)
251+
kzg_setups: pyspec
264252
@for preset in minimal mainnet; do \
265253
$(PYTHON_VENV) $(SCRIPTS_DIR)/gen_kzg_trusted_setups.py \
266254
--secret=1337 \

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ Documentation on the different components used during spec writing can be found
8181

8282
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).
8383

84-
8584
## Installation and Usage
8685
The consensus-specs repo can be used by running the tests locally or inside a docker container.
8786

configs/mainnet.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
171171
SAMPLES_PER_SLOT: 8
172172
CUSTODY_REQUIREMENT: 4
173173
MAX_BLOBS_PER_BLOCK_FULU: 12
174-
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU`
175-
MAX_REQUEST_BLOB_SIDECARS_FULU: 1536
174+
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
176175

177176
# Whisk
178177
# `Epoch(2**8)`

configs/minimal.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
172172
SAMPLES_PER_SLOT: 8
173173
CUSTODY_REQUIREMENT: 4
174174
MAX_BLOBS_PER_BLOCK_FULU: 12
175-
# `MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_FULU`
176-
MAX_REQUEST_BLOB_SIDECARS_FULU: 1536
175+
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
177176

178177
# Whisk
179178
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4

docker/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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

@@ -13,6 +14,7 @@ Ideally manual running of docker containers is for advanced users, we recommend
1314
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

docs/docs/new-feature.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# How to add a new feature proposal in consensus-specs
22

3+
## Table of contents
4+
35
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
46
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5-
## Table of Contents
67

78
- [A. Make it executable for linter checks](#a-make-it-executable-for-linter-checks)
89
- [1. Create a folder under `./specs/_features`](#1-create-a-folder-under-specs_features)
@@ -23,7 +24,6 @@
2324

2425
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2526

26-
2727
## A. Make it executable for linter checks
2828

2929
### 1. Create a folder under `./specs/_features`
@@ -35,6 +35,7 @@ For example, if it's an `EIP-9999` CL spec, you can create a `./specs/_features/
3535
For example, if the latest fork is Capella, use `./specs/capella` content as your "previous fork".
3636

3737
### 3. Write down your proposed `beacon-chain.md` change
38+
3839
- You can either use [Beacon Chain Spec Template](./templates/beacon-chain-template.md), or make a copy of the latest fork content and then edit it.
3940
- Tips:
4041
- We use [`doctoc`](https://www.npmjs.com/package/doctoc) tool to generate the table of content.
@@ -50,8 +51,11 @@ For example, if the latest fork is Capella, use `./specs/capella` content as you
5051
- Use simple Python rather than the fancy Python dark magic.
5152

5253
### 4. Add `fork.md`
54+
5355
You can refer to the previous fork's `fork.md` file.
56+
5457
### 5. Make it executable
58+
5559
- Update Pyspec [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py) with the new feature name.
5660
- Update helpers for [`setup.py`](https://github.com/ethereum/consensus-specs/blob/dev/setup.py) for building the spec:
5761
- Update [`pysetup/constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/pysetup/constants.py) with the new feature name as Pyspec `constants.py` defined.
@@ -63,17 +67,21 @@ You can refer to the previous fork's `fork.md` file.
6367
## B: Make it executable for pytest and test generator
6468

6569
### 1. [Optional] Add `light-client/*` docs if you updated the content of `BeaconBlock`
70+
6671
- You can refer to the previous fork's `light-client/*` file.
6772
- Add the path of the new markdown files in [`pysetup/md_doc_paths.py`](https://github.com/ethereum/consensus-specs/blob/dev/pysetup/md_doc_paths.py)'s `get_md_doc_paths` function.
6873

6974
### 2. Add the mainnet and minimal presets and update the configs
75+
7076
- Add presets: `presets/mainnet/<new-feature-name>.yaml` and `presets/minimal/<new-feature-name>.yaml`
7177
- Update configs: `configs/mainnet.yaml` and `configs/minimal.yaml`
7278

7379
### 3. Update [`context.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/context.py)
80+
7481
- [Optional] Add `with_<new-feature-name>_and_later` decorator for writing pytest cases. e.g., `with_capella_and_later`.
7582

7683
### 4. Update [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py)
84+
7785
- Add `<NEW_FEATURE>` to `ALL_PHASES` and `TESTGEN_FORKS`
7886

7987
### 5. Update [`genesis.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/genesis.py):
@@ -94,6 +102,7 @@ def create_genesis_state(spec, validator_balances, activation_threshold):
94102
- If the given feature changes `ExecutionPayload` fields, you have to set the initial values by updating `get_sample_genesis_execution_payload_header` helper.
95103

96104
### 6. Update CI configurations
105+
97106
- Update [GitHub Actions config](https://github.com/ethereum/consensus-specs/blob/dev/.github/workflows/run-tests.yml)
98107
- Update `pyspec-tests.strategy.matrix.version` list by adding new feature to it
99108
- Update [CircleCI config](https://github.com/ethereum/consensus-specs/blob/dev/.circleci/config.yml)
@@ -102,7 +111,9 @@ def create_genesis_state(spec, validator_balances, activation_threshold):
102111
## Others
103112

104113
### Bonus
114+
105115
- Add `validator.md` if honest validator behavior changes with the new feature.
106116

107117
### Need help?
118+
108119
You can tag spec elves for cleaning up your PR. 🧚

0 commit comments

Comments
 (0)