Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
621fbf3
Refactor bls generator (#4304)
jtraglia May 9, 2025
6b51684
Improve generator UX (#4309)
jtraglia May 9, 2025
f6c6e6e
Refactor `gen_runner` (#4310)
jtraglia May 9, 2025
221f589
Fix typos in blob configuration comments for fulu presets (#4311)
leolara May 12, 2025
ae96ca2
Introduce blob schedule (#4277)
GabrielAstieres May 12, 2025
c275898
Bump the actions group with 2 updates (#4312)
dependabot[bot] May 13, 2025
c9fda07
Clarification on custody sampling (#4251)
ppopth May 15, 2025
a3cc183
Simplify reference test generators (#4317)
jtraglia May 15, 2025
b28ad47
Fix assert in `run_get_committee_assignment` (#4315)
jihoonsong May 15, 2025
03c4ea2
Wrap lines at 80 characters in all markdown files
jtraglia May 15, 2025
aa1350f
Merge pull request #4321 from jtraglia/markdown-line-wrap
GabrielAstieres May 16, 2025
cc6996c
Generate reference tests for EIP7732 & EIP7805 (#4319)
jtraglia May 16, 2025
8e813da
Use latest version of uv when creating the venv (#4325)
jtraglia May 16, 2025
2da4b9c
Fix link to das-core in fulu validator specs (#4324)
jtraglia May 16, 2025
e0d6967
Do import sorting with isort (#4327)
jihoonsong May 17, 2025
ce38cd5
Fix phase run decorator to skip EIP-7732 as intended (#4326)
jihoonsong May 17, 2025
45159ad
Update `isort` to `order_by_type = false` (#4328)
jihoonsong May 18, 2025
de0875a
Bump version to 1.6.0-alpha.0 (#4329)
jtraglia May 18, 2025
f08555c
Add to epoch processing tests generation states before and after full…
leolara May 19, 2025
921087e
State that reconstructed sidecars which are not custodied may be dele…
jtraglia May 19, 2025
7a8f248
Clarify node behavior when validator custody changes (#4320)
jtraglia May 19, 2025
3b7421f
Bind inputs in ssz_generic reftests (#4333)
jtraglia May 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 1 addition & 6 deletions .github/workflows/generate_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ jobs:
- name: Generate tests
run: |
cd consensus-specs
make -j$(nproc) gen_all 2>&1 | tee ../consensustestgen.log
make reftests verbose=true 2>&1 | tee ../consensustestgen.log
cp -r presets/ ../consensus-spec-tests/presets
cp -r configs/ ../consensus-spec-tests/configs
find . -type d -empty -delete
- name: Check for errors
run: |
if grep -q "\[ERROR\]" consensustestgen.log; then
echo "There is an error in the log"
exit 1
fi
if find . -type f -name "INCOMPLETE" | grep -q "INCOMPLETE"; then
echo "There is an INCOMPLETE file"
exit 1
fi
- name: Archive configurations
run: |
cd consensus-spec-tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- deneb
- electra
- fulu
- eip7441
- eip7732
- eip7805
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
22 changes: 1 addition & 21 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
- deneb
- electra
- fulu
- eip7441
- eip7732
- eip7805
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -62,23 +62,3 @@ jobs:
cache: 'pip'
- name: Run pyspec tests for ${{ matrix.fork }}
run: make test preset=minimal fork=${{ matrix.fork }}

modcheck:
needs: [lint, whitespace]
runs-on: [self-hosted-ghr-custom, size-s-x64, profile-consensusSpecs]
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
cache: 'pip'
- name: Run generators with --modcheck
run: make gen_all modcheck=true 2>&1 | tee consensustestgen.log
- name: Check for errors
run: |
if grep -q "\[ERROR\]" consensustestgen.log; then
echo "There is an error in the log"
exit 1
fi
113 changes: 42 additions & 71 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ ALL_EXECUTABLE_SPEC_NAMES = \
eip6800 \
eip7441 \
eip7732 \
eip7805
eip7805

# A list of fake targets.
.PHONY: \
clean \
coverage \
detect_errors \
gen_all \
gen_list \
help \
kzg_setups \
lint \
pyspec \
reftests \
serve_docs \
test

Expand All @@ -38,17 +36,14 @@ NORM = $(shell tput sgr0)

# Print target descriptions.
help:
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
@echo "make $(BOLD)detect_errors$(NORM) -- detect generator errors"
@echo "make $(BOLD)gen_<gen>$(NORM) -- run a single generator"
@echo "make $(BOLD)gen_all$(NORM) -- run all generators"
@echo "make $(BOLD)gen_list$(NORM) -- list all generator targets"
@echo "make $(BOLD)kzg_setups$(NORM) -- generate trusted setups"
@echo "make $(BOLD)lint$(NORM) -- run the linters"
@echo "make $(BOLD)pyspec$(NORM) -- generate python specifications"
@echo "make $(BOLD)serve_docs$(NORM) -- start a local docs web server"
@echo "make $(BOLD)test$(NORM) -- run pyspec tests"
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
@echo "make $(BOLD)kzg_setups$(NORM) -- generate trusted setups"
@echo "make $(BOLD)lint$(NORM) -- run the linters"
@echo "make $(BOLD)pyspec$(NORM) -- build python specifications"
@echo "make $(BOLD)reftests$(NORM) -- generate reference tests"
@echo "make $(BOLD)serve_docs$(NORM) -- start a local docs web server"
@echo "make $(BOLD)test$(NORM) -- run pyspec tests"

###############################################################################
# Virtual Environment
Expand All @@ -64,7 +59,7 @@ MDFORMAT_VENV = $(VENV)/bin/mdformat
$(VENV):
@echo "Creating virtual environment"
@python3 -m venv $(VENV)
@$(PIP_VENV) install --quiet uv==0.5.24
@$(PIP_VENV) install --quiet --upgrade uv

###############################################################################
# Specification
Expand Down Expand Up @@ -189,82 +184,58 @@ MARKDOWN_FILES = $(CURDIR)/README.md \

# Check for mistakes.
lint: pyspec
@$(MDFORMAT_VENV) --number $(MARKDOWN_FILES)
@$(MDFORMAT_VENV) --number --wrap=80 $(MARKDOWN_FILES)
@$(CODESPELL_VENV) . --skip "./.git,$(VENV),$(PYSPEC_DIR)/.mypy_cache" -I .codespell-whitelist
@$(PYTHON_VENV) -m black $(CURDIR)/tests
@$(PYTHON_VENV) -m isort --quiet $(CURDIR)/tests
@$(PYTHON_VENV) -m black --quiet $(CURDIR)/tests
@$(PYTHON_VENV) -m pylint --rcfile $(PYLINT_CONFIG) $(PYLINT_SCOPE)
@$(PYTHON_VENV) -m mypy --config-file $(MYPY_CONFIG) $(MYPY_SCOPE)

###############################################################################
# Generators
###############################################################################

TEST_VECTOR_DIR = $(CURDIR)/../consensus-spec-tests/tests
GENERATOR_DIR = $(CURDIR)/tests/generators
SCRIPTS_DIR = $(CURDIR)/scripts
GENERATOR_ERROR_LOG_FILE = $(TEST_VECTOR_DIR)/testgen_error_log.txt
GENERATORS = $(sort $(dir $(wildcard $(GENERATOR_DIR)/*/.)))
GENERATOR_TARGETS = $(patsubst $(GENERATOR_DIR)/%/, gen_%, $(GENERATORS))
COMMA:= ,
TEST_VECTOR_DIR = $(CURDIR)/../consensus-spec-tests/tests

# List available generators.
gen_list:
@for target in $(shell echo $(GENERATOR_TARGETS) | tr ' ' '\n' | sort -n); do \
echo $$target; \
done

# Run one generator.
# Generate reference tests.
# This will forcibly rebuild pyspec just in case.
# To print more details, append verbose=true, eg:
# make gen_bls verbose=true
# To check modules for a generator, append modcheck=true, eg:
# make gen_genesis modcheck=true
# To run the generator for a specific test, append k=<test>, eg:
# make gen_operations k=invalid_committee_index
# To run the generator for a specific fork, append fork=<fork>, eg:
# make gen_operations fork=fulu
# To run the generator for a specific preset, append preset=<preset>, eg:
# make gen_operations preset=mainnet
# To run the generator for a list of tests, forks, and/or presets, append them as comma-separated lists, eg:
# make gen_operations k=invalid_committee_index,invalid_too_many_committee_bits
# To generate reference tests for a single runner, append runner=<runner>, eg:
# make reftests runner=bls
# To generate reference tests with more details, append verbose=true, eg:
# make reftests runner=bls verbose=true
# To generate reference tests with fewer threads, append threads=N, eg:
# make reftests runner=bls threads=1
# To generate reference tests for a specific test, append k=<test>, eg:
# make reftests runner=operations k=invalid_committee_index
# To generate reference tests for a specific fork, append fork=<fork>, eg:
# make reftests runner=operations fork=fulu
# To generate reference tests for a specific preset, append preset=<preset>, eg:
# make reftests runner=operations preset=mainnet
# To generate reference tests for a list of tests, forks, and/or presets, append them as comma-separated lists, eg:
# make reftests runner=operations k=invalid_committee_index,invalid_too_many_committee_bits
# Or all at the same time, eg:
# make gen_operations preset=mainnet fork=fulu k=invalid_committee_index
gen_%: MAYBE_VERBOSE := $(if $(filter true,$(verbose)),--verbose)
gen_%: MAYBE_MODCHECK := $(if $(filter true,$(modcheck)),--modcheck)
gen_%: MAYBE_TESTS := $(if $(k),--case-list $(subst ${COMMA}, ,$(k)))
gen_%: MAYBE_FORKS := $(if $(fork),--fork-list $(subst ${COMMA}, ,$(fork)))
gen_%: MAYBE_PRESETS := $(if $(preset),--preset-list $(subst ${COMMA}, ,$(preset)))
gen_%: pyspec
@mkdir -p $(TEST_VECTOR_DIR)
@$(PYTHON_VENV) $(GENERATOR_DIR)/$*/main.py \
# make reftests runner=operations preset=mainnet fork=fulu k=invalid_committee_index
reftests: MAYBE_VERBOSE := $(if $(filter true,$(verbose)),--verbose)
reftests: MAYBE_THREADS := $(if $(threads),--threads=$(threads))
reftests: MAYBE_RUNNERS := $(if $(runner),--runners $(subst ${COMMA}, ,$(runner)))
reftests: MAYBE_TESTS := $(if $(k),--cases $(subst ${COMMA}, ,$(k)))
reftests: MAYBE_FORKS := $(if $(fork),--forks $(subst ${COMMA}, ,$(fork)))
reftests: MAYBE_PRESETS := $(if $(preset),--presets $(subst ${COMMA}, ,$(preset)))
reftests: pyspec
@$(PYTHON_VENV) -m tests.generators.main \
--output $(TEST_VECTOR_DIR) \
$(MAYBE_VERBOSE) \
$(MAYBE_MODCHECK) \
$(MAYBE_THREADS) \
$(MAYBE_RUNNERS) \
$(MAYBE_TESTS) \
$(MAYBE_FORKS) \
$(MAYBE_PRESETS)

# Run all generators then check for errors.
gen_all: $(GENERATOR_TARGETS)
@$(MAKE) detect_errors

# Detect errors in generators.
detect_errors: $(TEST_VECTOR_DIR)
@incomplete_files=$$(find $(TEST_VECTOR_DIR) -name "INCOMPLETE"); \
if [ -n "$$incomplete_files" ]; then \
echo "[ERROR] incomplete detected"; \
exit 1; \
fi
@if [ -f $(GENERATOR_ERROR_LOG_FILE) ]; then \
echo "[ERROR] $(GENERATOR_ERROR_LOG_FILE) file exists"; \
exit 1; \
fi
@echo "[PASSED] no errors detected"

# Generate KZG trusted setups for testing.
kzg_setups: pyspec
@for preset in minimal mainnet; do \
$(PYTHON_VENV) $(SCRIPTS_DIR)/gen_kzg_trusted_setups.py \
$(PYTHON_VENV) $(CURDIR)/scripts/gen_kzg_trusted_setups.py \
--secret=1337 \
--g1-length=4096 \
--g2-length=65 \
Expand Down
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
[![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)

This repository hosts the current Ethereum
[proof-of-stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/) specifications.
Discussions about design rationale and proposed changes can be brought up and discussed as issues.
Solidified, agreed-upon changes to the specifications can be made through pull requests.
[proof-of-stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/)
specifications. Discussions about design rationale and proposed changes can be
brought up and discussed as issues. Solidified, agreed-upon changes to the
specifications can be made through pull requests.

## Specifications

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

### Stable Specifications

Expand All @@ -39,8 +41,8 @@ sequential upgrades when ready.

### External specifications

Additional specifications and standards outside of requisite client functionality can be found in
the following repositories:
Additional specifications and standards outside of requisite client
functionality can be found in the following repositories:

- [Beacon APIs](https://github.com/ethereum/beacon-apis)
- [Engine APIs](https://github.com/ethereum/execution-apis/tree/main/src/engine)
Expand All @@ -49,11 +51,11 @@ the following repositories:

### Reference tests

Reference 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) repository. Compressed
tarballs are available for each release
[here](https://github.com/ethereum/consensus-spec-tests/releases). Nightly reference tests are
available
Reference 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)
repository. Compressed tarballs are available for each release
[here](https://github.com/ethereum/consensus-spec-tests/releases). Nightly
reference tests are available
[here](https://github.com/ethereum/consensus-specs/actions/workflows/generate_vectors.yml).

## Contributors
Expand All @@ -80,12 +82,16 @@ make help

### Design goals

The following are the broad design goals for the Ethereum proof-of-stake consensus specifications:
The following are the broad design goals for the Ethereum proof-of-stake
consensus specifications:

- Minimize complexity, even at the cost of some losses in efficiency.
- Remain live through major network partitions and when very large portions of nodes go offline.
- Select components that are quantum secure or easily swappable for quantum-secure alternatives.
- Utilize crypto and design techniques that allow for a large participation of validators.
- Remain live through major network partitions and when very large portions of
nodes go offline.
- Select components that are quantum secure or easily swappable for
quantum-secure alternatives.
- Utilize crypto and design techniques that allow for a large participation of
validators.
- Minimize hardware requirements such that a consumer laptop can participate.

### Useful resources
Expand Down
12 changes: 11 additions & 1 deletion configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ SAMPLES_PER_SLOT: 8
CUSTODY_REQUIREMENT: 4
VALIDATOR_CUSTODY_REQUIREMENT: 8
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
MAX_BLOBS_PER_BLOCK_FULU: 12
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096

# EIP7441
Expand All @@ -191,3 +190,14 @@ VIEW_FREEZE_DEADLINE: 9
MAX_REQUEST_INCLUSION_LIST: 16
# 2**13 (= 8192)
MAX_BYTES_PER_INCLUSION_LIST: 8192

# Blob Scheduling
# ---------------------------------------------------------------

BLOB_SCHEDULE:
# Deneb
- EPOCH: 269568
MAX_BLOBS_PER_BLOCK: 6
# Electra
- EPOCH: 364032
MAX_BLOBS_PER_BLOCK: 9
12 changes: 11 additions & 1 deletion configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ SAMPLES_PER_SLOT: 8
CUSTODY_REQUIREMENT: 4
VALIDATOR_CUSTODY_REQUIREMENT: 8
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
MAX_BLOBS_PER_BLOCK_FULU: 12
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096

# EIP7441
Expand All @@ -188,3 +187,14 @@ VIEW_FREEZE_DEADLINE: 3
MAX_REQUEST_INCLUSION_LIST: 16
# 2**13 (= 8192)
MAX_BYTES_PER_INCLUSION_LIST: 8192

# Blob Scheduling
# ---------------------------------------------------------------

BLOB_SCHEDULE:
# Deneb
- EPOCH: 18446744073709551615
MAX_BLOBS_PER_BLOCK: 6
# Electra
- EPOCH: 18446744073709551615
MAX_BLOBS_PER_BLOCK: 9
4 changes: 2 additions & 2 deletions docs/docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ cp -r presets ../consensus-spec-tests
cp -r configs ../consensus-spec-tests
```

Next, use `make gen_all` to generate all the reference tests. The following command will run all
Next, use `make reftests` to generate all the reference tests. The following command will run all
generators in parallel for maximum speed. The console output is saved to a file so we can check for
errors afterwards.

Expand All @@ -143,7 +143,7 @@ errors afterwards.
> to do this. Note that the "Bundle Reference Tests" section can be skipped if this route is taken.

```bash
make --jobs gen_all 2>&1 | tee ../consensustestgen.log
make reftests verbose=true 2>&1 | tee ../consensustestgen.log
```

Next, check for errors by searching for "ERROR" in test logfile.
Expand Down
4 changes: 2 additions & 2 deletions presets/mainnet/fulu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4

# Blob
# ---------------------------------------------------------------
# 2**6` (= 64)
# 2**6 (= 64)
FIELD_ELEMENTS_PER_CELL: 64
# 2**0 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
# 2**1 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
FIELD_ELEMENTS_PER_EXT_BLOB: 8192
4 changes: 2 additions & 2 deletions presets/minimal/fulu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4

# Blob
# ---------------------------------------------------------------
# 2**6` (= 64)
# 2**6 (= 64)
FIELD_ELEMENTS_PER_CELL: 64
# 2**0 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
# 2**1 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
FIELD_ELEMENTS_PER_EXT_BLOB: 8192
Loading