Skip to content

Commit 0c5549e

Browse files
committed
Merge branch 'dev' into df-rlptx
2 parents d61f95e + d14fb52 commit 0c5549e

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

+489
-411
lines changed

.github/workflows/generate_vectors.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ on:
1212
default: dev
1313
type: string
1414
required: true
15+
schedule:
16+
- cron: '0 2 * * *'
1517

1618
jobs:
1719
generate-tests:
18-
runs-on: [self-hosted-ghr-custom, size-chungus-x64, profile-consensusSpecs]
20+
runs-on: [self-hosted-ghr-custom, size-xl-x64, profile-consensusSpecs]
1921
steps:
2022
- name: Checkout repository
2123
uses: actions/checkout@v4
2224
with:
2325
repository: 'ethereum/consensus-specs'
2426
path: 'consensus-specs'
25-
ref: ${{ inputs.source_ref }}
27+
ref: ${{ inputs.ref || 'dev' }}
2628
- name: Checkout consensus-spec-tests repository
2729
uses: actions/checkout@v4
2830
with:

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ dist_check:
9696
dist_upload:
9797
python3 -m twine upload dist/*
9898

99+
build_wheel: install_test pyspec
100+
. venv/bin/activate && \
101+
python3 -m build --no-isolation --outdir ./dist ./
99102

100103
# "make generate_tests" to run all generators
101104
generate_tests: $(GENERATOR_TARGETS)
@@ -195,7 +198,8 @@ define run_generator
195198
cd $(GENERATOR_DIR)/$(1); \
196199
if ! test -d venv; then python3 -m venv venv; fi; \
197200
. venv/bin/activate; \
198-
pip3 install -r requirements.txt; \
201+
pip3 install ../../../dist/eth2spec-*.whl; \
202+
pip3 install 'eth2spec[generator]'; \
199203
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR); \
200204
echo "generator $(1) finished"
201205
endef
@@ -217,7 +221,7 @@ gen_kzg_setups:
217221

218222
# For any generator, build it using the run_generator function.
219223
# (creation of output dir is a dependency)
220-
gen_%: $(TEST_VECTOR_DIR)
224+
gen_%: build_wheel $(TEST_VECTOR_DIR)
221225
$(call run_generator,$*)
222226

223227
detect_generator_incomplete: $(TEST_VECTOR_DIR)

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,19 @@ Documentation on the different components used during spec writing can be found
7373
## Consensus spec tests
7474

7575
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).
76+
77+
78+
## Installation and Usage
79+
The consensus-specs repo can be used by running the tests locally or inside a docker container.
80+
81+
To run the tests locally:
82+
- Clone the repository with `git clone https://github.com/ethereum/consensus-specs.git`
83+
- Switch to the directory `cd consensus-specs`
84+
- Install the dependencies with: `make install_test && make preinstallation && make pyspec`
85+
- Run the tests with `make citest`
86+
87+
To run the tests inside a docker container:
88+
- Switch to the directory with `cd scripts`
89+
- Run the script `./build_run_docker_tests.sh`
90+
- Find the results in a folder called `./testResults`
91+
- Find more ways to customize the script with `./build_run_docker_tests.sh --h`

configs/mainnet.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,6 @@ CUSTODY_REQUIREMENT: 4
169169
# [New in Electra:EIP7251]
170170
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
171171
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000 # 2**8 * 10**9 (= 256,000,000,000)
172+
173+
# EIP7732
174+
MAX_REQUEST_PAYLOADS: 128

configs/minimal.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,6 @@ CUSTODY_REQUIREMENT: 4
168168
# [New in Electra:EIP7251]
169169
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
170170
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
171+
172+
# EIP7732
173+
MAX_REQUEST_PAYLOADS: 128

docker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Ideally manual running of docker containers is for advanced users, we recommend
1313
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.
1414

1515
E.g:
16-
- `./build_run_test.sh --p mainnet` will run the mainnet preset tests
17-
- `./build_run_test.sh --a` will run all the tests across all the forks
18-
- `./build_run_test.sh --f deneb` will only run deneb tests
16+
- `./build_run_docker_tests.sh --p mainnet` will run the mainnet preset tests
17+
- `./build_run_docker_tests.sh --a` will run all the tests across all the forks
18+
- `./build_run_docker_tests.sh --f deneb` will only run deneb tests
1919

2020
Results are always placed in a folder called `./testResults`. The results are `.xml` files and contain the fork they represent and the date/time they were run at.

pysetup/spec_builders/electra.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,41 @@ def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
1919
'CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(86)',
2020
'NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(87)',
2121
}
22+
23+
24+
@classmethod
25+
def execution_engine_cls(cls) -> str:
26+
return """
27+
class NoopExecutionEngine(ExecutionEngine):
28+
29+
def notify_new_payload(self: ExecutionEngine,
30+
execution_payload: ExecutionPayload,
31+
execution_requests: ExecutionRequests,
32+
parent_beacon_block_root: Root) -> bool:
33+
return True
34+
35+
def notify_forkchoice_updated(self: ExecutionEngine,
36+
head_block_hash: Hash32,
37+
safe_block_hash: Hash32,
38+
finalized_block_hash: Hash32,
39+
payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]:
40+
pass
41+
42+
def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> GetPayloadResponse:
43+
# pylint: disable=unused-argument
44+
raise NotImplementedError("no default block production")
45+
46+
def is_valid_block_hash(self: ExecutionEngine,
47+
execution_payload: ExecutionPayload,
48+
parent_beacon_block_root: Root) -> bool:
49+
return True
50+
51+
def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool:
52+
return True
53+
54+
def verify_and_notify_new_payload(self: ExecutionEngine,
55+
new_payload_request: NewPayloadRequest) -> bool:
56+
return True
57+
58+
59+
EXECUTION_ENGINE = NoopExecutionEngine()"""

requirements_preinstallation.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pip>=24.0.0
22
wheel>=0.44.0
33
setuptools>=72.0.0
4-
pylint>=3.2.0
4+
pylint>=3.2.0
5+
build>=1.2.2

scripts/build_run_docker_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
# Set variables
13-
ALL_EXECUTABLE_SPECS=("phase0" "altair" "bellatrix" "capella" "deneb" "electra" "whisk")
13+
ALL_EXECUTABLE_SPECS=("phase0" "altair" "bellatrix" "capella" "deneb" "electra" "whisk" "eip7594")
1414
TEST_PRESET_TYPE=minimal
1515
FORK_TO_TEST=phase0
1616
WORKDIR="//consensus-specs//tests//core//pyspec"

setup.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,32 +524,36 @@ def run(self):
524524
long_description=readme,
525525
long_description_content_type="text/markdown",
526526
author="ethereum",
527-
url="https://github.com/ethereum/eth2.0-specs",
527+
url="https://github.com/ethereum/consensus-specs",
528528
include_package_data=False,
529-
package_data={'configs': ['*.yaml'],
530-
'presets': ['*.yaml'],
531-
'specs': ['**/*.md'],
532-
'eth2spec': ['VERSION.txt']},
529+
package_data={
530+
'configs': ['*.yaml'],
531+
'eth2spec': ['VERSION.txt'],
532+
'presets': ['**/*.yaml', '**/*.json'],
533+
'specs': ['**/*.md'],
534+
'sync': ['optimistic.md'],
535+
},
533536
package_dir={
534-
"eth2spec": "tests/core/pyspec/eth2spec",
535537
"configs": "configs",
538+
"eth2spec": "tests/core/pyspec/eth2spec",
536539
"presets": "presets",
537540
"specs": "specs",
541+
"sync": "sync",
538542
},
539-
packages=find_packages(where='tests/core/pyspec') + ['configs', 'specs'],
543+
packages=find_packages(where='tests/core/pyspec') + ['configs', 'presets', 'specs', 'presets', 'sync'],
540544
py_modules=["eth2spec"],
541545
cmdclass=commands,
542546
python_requires=">=3.9, <4",
543547
extras_require={
544548
"test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
545549
"lint": ["flake8==5.0.4", "mypy==0.981", "pylint==2.15.3"],
546-
"generator": ["python-snappy==0.6.1", "filelock", "pathos==0.3.0"],
550+
"generator": ["setuptools>=72.0.0", "pytest>4.4", "python-snappy==0.7.3", "filelock", "pathos==0.3.0"],
547551
"docs": ["mkdocs==1.4.2", "mkdocs-material==9.1.5", "mdx-truly-sane-lists==1.3", "mkdocs-awesome-pages-plugin==2.8.0"]
548552
},
549553
install_requires=[
550554
"eth-utils>=2.0.0,<3",
551555
"eth-typing>=3.2.0,<4.0.0",
552-
"pycryptodome==3.15.0",
556+
"pycryptodome>=3.19.1",
553557
"py_ecc==6.0.0",
554558
"milagro_bls_binding==1.9.0",
555559
"remerkleable==0.1.28",

0 commit comments

Comments
 (0)