Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Withdrawals push #2836

Merged
merged 39 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c81c27e
Merge pull request #2733 from ethereum/dev
djrtwo Nov 24, 2021
4f24fe4
basic capella withdrawal in place
djrtwo Dec 1, 2021
155863d
add capella to circleci build
djrtwo Dec 1, 2021
b7308e0
remove capella built files
djrtwo Dec 1, 2021
78d5583
fix tsts
djrtwo Dec 1, 2021
ca74094
Apply suggestions from code review
djrtwo Dec 2, 2021
3024dc8
add withdrawn_epoch to capella validators
djrtwo Dec 2, 2021
2010994
add capella circleci workflow
djrtwo Dec 2, 2021
180abb9
clean up some withdrawal logic and add tests
djrtwo Dec 2, 2021
6969c8a
lint
djrtwo Dec 2, 2021
59d4821
fix forkchoice tests
djrtwo Dec 2, 2021
365b1f4
remove unnecessary definitions from CapellaSpecBuilder
djrtwo Dec 2, 2021
93c933c
Merge pull request #2771 from ethereum/dev
hwwhww Dec 22, 2021
180855b
Merge pull request #2778 from ethereum/dev
hwwhww Dec 24, 2021
171a9cc
Resolve conflicts
hwwhww Dec 27, 2021
3b474eb
Add capella to test coverage report target
hwwhww Dec 27, 2021
cbf314c
Move capella fork tests to the correct folder and resolve conflicts
hwwhww Dec 27, 2021
e80a142
modified withdrawals for push
djrtwo Feb 23, 2022
2026103
Merge branch 'dev' into withdrawals-push
djrtwo Feb 23, 2022
e49f73c
fix tx type
djrtwo Feb 23, 2022
eef2dbb
Ensure that the SSZ classes are ordered
hwwhww Feb 24, 2022
0b89c7f
Update specs/capella/beacon-chain.md
ralexstokes Feb 24, 2022
fb90451
Merge pull request #2837 from ethereum/fix-build_spec
djrtwo Feb 24, 2022
d513f5c
fix lint
djrtwo Feb 24, 2022
f5dab5b
fix fully withdrawal tests
djrtwo Feb 24, 2022
0a55f06
fix execution paylaod tests
djrtwo Feb 24, 2022
e1b9cf9
add withdrawal index to wihdrawal transaction
djrtwo Mar 3, 2022
507f550
Merge branch 'dev' into withdrawals-push
djrtwo Mar 10, 2022
3dd83cf
minor withdrawals renamings
djrtwo Mar 10, 2022
255e942
add validator and fork-choice mods for withdrawals in capella
djrtwo Mar 16, 2022
36aae1d
add tests for process_withdrawals
djrtwo Mar 16, 2022
493b169
refine naming for withdrawals
djrtwo Mar 22, 2022
9a8ff4f
topo sort
djrtwo Mar 22, 2022
03f9503
Apply suggestions from code review
djrtwo Mar 22, 2022
43ce98b
Merge branch 'withdrawals-push' of github.com:ethereum/eth2.0-specs i…
djrtwo Mar 22, 2022
c10d219
Merge branch 'dev' into withdrawals-push
djrtwo Mar 22, 2022
a2db446
build
djrtwo Mar 22, 2022
b469593
toc
djrtwo Mar 22, 2022
8a388f2
toc
hwwhww Mar 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ jobs:
command: make citest fork=bellatrix
- store_test_results:
path: tests/core/pyspec/test-reports
test-capella:
docker:
- image: circleci/python:3.8
working_directory: ~/specs-repo
steps:
- restore_cache:
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
- restore_pyspec_cached_venv
- run:
name: Run py-tests
command: make citest fork=capella
- store_test_results:
path: tests/core/pyspec/test-reports

table_of_contents:
docker:
- image: circleci/node:10.16.3
Expand Down Expand Up @@ -243,6 +257,9 @@ workflows:
- test-bellatrix:
requires:
- install_pyspec_test
- test-capella:
requires:
- install_pyspec_test
- table_of_contents
- codespell
- lint:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ consensus-spec-tests/
tests/core/pyspec/eth2spec/phase0/
tests/core/pyspec/eth2spec/altair/
tests/core/pyspec/eth2spec/bellatrix/
tests/core/pyspec/eth2spec/capella/

# coverage reports
.htmlcov
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENER

MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/phase0/*.md) $(wildcard $(SPEC_DIR)/altair/*.md) $(wildcard $(SSZ_DIR)/*.md) \
$(wildcard $(SPEC_DIR)/bellatrix/*.md) \
$(wildcard $(SPEC_DIR)/capella/*.md) \
$(wildcard $(SPEC_DIR)/custody/*.md) \
$(wildcard $(SPEC_DIR)/das/*.md) \
$(wildcard $(SPEC_DIR)/sharding/*.md) \
Expand Down Expand Up @@ -98,12 +99,12 @@ install_test:
# Testing against `minimal` config by default
test: pyspec
. venv/bin/activate; cd $(PY_SPEC_DIR); \
python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec
python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec

# Testing against `minimal` config by default
find_test: pyspec
. venv/bin/activate; cd $(PY_SPEC_DIR); \
python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec
python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.minimal --cov=eth2spec.altair.minimal --cov=eth2spec.bellatrix.minimal --cov=eth2spec.capella.minimal --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec

citest: pyspec
mkdir -p tests/core/pyspec/test-reports/eth2spec;
Expand Down Expand Up @@ -136,7 +137,7 @@ lint: pyspec
. venv/bin/activate; cd $(PY_SPEC_DIR); \
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
&& pylint --disable=all --enable unused-argument ./eth2spec/phase0 ./eth2spec/altair ./eth2spec/bellatrix \
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.altair -p eth2spec.bellatrix -p eth2spec.capella

lint_generators: pyspec
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
Expand Down
7 changes: 6 additions & 1 deletion configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ ALTAIR_FORK_EPOCH: 74240 # Oct 27, 2021, 10:56:23am UTC
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000000
BELLATRIX_FORK_EPOCH: 18446744073709551615
# Capella
CAPELLA_FORK_VERSION: 0x03000000
CAPELLA_FORK_EPOCH: 18446744073709551615
# Sharding
SHARDING_FORK_VERSION: 0x03000000
SHARDING_FORK_VERSION: 0x04000000
SHARDING_FORK_EPOCH: 18446744073709551615




# Time parameters
# ---------------------------------------------------------------
# 12 seconds
Expand Down
5 changes: 4 additions & 1 deletion configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ ALTAIR_FORK_EPOCH: 18446744073709551615
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000001
BELLATRIX_FORK_EPOCH: 18446744073709551615
# Capella
CAPELLA_FORK_VERSION: 0x03000001
CAPELLA_FORK_EPOCH: 18446744073709551615
# Sharding
SHARDING_FORK_VERSION: 0x03000001
SHARDING_FORK_VERSION: 0x04000001
SHARDING_FORK_EPOCH: 18446744073709551615


Expand Down
1 change: 1 addition & 0 deletions presets/mainnet/capella.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Minimal preset - Capella
1 change: 1 addition & 0 deletions presets/minimal/capella.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Minimal preset - Capella
44 changes: 37 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import ast
import subprocess
import sys
import copy
from collections import OrderedDict


# NOTE: have to programmatically include third-party dependencies in `setup.py`.
def installPackage(package: str):
Expand Down Expand Up @@ -41,6 +44,8 @@ def installPackage(package: str):
PHASE0 = 'phase0'
ALTAIR = 'altair'
BELLATRIX = 'bellatrix'
CAPELLA = 'capella'


# The helper functions that are used when defining constants
CONSTANT_DEP_SUNDRY_CONSTANTS_FUNCTIONS = '''
Expand Down Expand Up @@ -549,9 +554,22 @@ def hardcoded_custom_type_dep_constants(cls) -> str:
return {**super().hardcoded_custom_type_dep_constants(), **constants}


#
# CapellaSpecBuilder
#
class CapellaSpecBuilder(BellatrixSpecBuilder):
fork: str = CAPELLA

@classmethod
def imports(cls, preset_name: str):
return super().imports(preset_name) + f'''
from eth2spec.bellatrix import {preset_name} as bellatrix
'''


spec_builders = {
builder.fork: builder
for builder in (Phase0SpecBuilder, AltairSpecBuilder, BellatrixSpecBuilder)
for builder in (Phase0SpecBuilder, AltairSpecBuilder, BellatrixSpecBuilder, CapellaSpecBuilder)
}


Expand Down Expand Up @@ -684,7 +702,7 @@ def combine_dicts(old_dict: Dict[str, T], new_dict: Dict[str, T]) -> Dict[str, T
'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',
'bytes', 'byte', 'ByteList', 'ByteVector',
'Dict', 'dict', 'field', 'ceillog2', 'floorlog2', 'Set',
'Optional',
'Optional', 'Sequence',
]


Expand All @@ -710,7 +728,6 @@ def dependency_order_class_objects(objects: Dict[str, str], custom_types: Dict[s
for item in [dep, key] + key_list[key_list.index(dep)+1:]:
objects[item] = objects.pop(item)


def combine_ssz_objects(old_objects: Dict[str, str], new_objects: Dict[str, str], custom_types) -> Dict[str, str]:
"""
Takes in old spec and new spec ssz objects, combines them,
Expand Down Expand Up @@ -800,7 +817,12 @@ def _build_spec(preset_name: str, fork: str,
spec_object = combine_spec_objects(spec_object, value)

class_objects = {**spec_object.ssz_objects, **spec_object.dataclasses}
dependency_order_class_objects(class_objects, spec_object.custom_types)

# Ensure it's ordered after multiple forks
new_objects = {}
while OrderedDict(new_objects) != OrderedDict(class_objects):
new_objects = copy.deepcopy(class_objects)
dependency_order_class_objects(class_objects, spec_object.custom_types)

return objects_to_spec(preset_name, spec_object, spec_builders[fork], class_objects)

Expand Down Expand Up @@ -847,14 +869,14 @@ def finalize_options(self):
if len(self.md_doc_paths) == 0:
print("no paths were specified, using default markdown file paths for pyspec"
" build (spec fork: %s)" % self.spec_fork)
if self.spec_fork in (PHASE0, ALTAIR, BELLATRIX):
if self.spec_fork in (PHASE0, ALTAIR, BELLATRIX, CAPELLA):
self.md_doc_paths = """
specs/phase0/beacon-chain.md
specs/phase0/fork-choice.md
specs/phase0/validator.md
specs/phase0/weak-subjectivity.md
"""
if self.spec_fork in (ALTAIR, BELLATRIX):
if self.spec_fork in (ALTAIR, BELLATRIX, CAPELLA):
self.md_doc_paths += """
specs/altair/beacon-chain.md
specs/altair/bls.md
Expand All @@ -863,14 +885,22 @@ def finalize_options(self):
specs/altair/p2p-interface.md
specs/altair/sync-protocol.md
"""
if self.spec_fork == BELLATRIX:
if self.spec_fork in (BELLATRIX, CAPELLA):
self.md_doc_paths += """
specs/bellatrix/beacon-chain.md
specs/bellatrix/fork.md
specs/bellatrix/fork-choice.md
specs/bellatrix/validator.md
sync/optimistic.md
"""
if self.spec_fork == CAPELLA:
self.md_doc_paths += """
specs/capella/beacon-chain.md
specs/capella/fork.md
specs/capella/fork-choice.md
specs/capella/validator.md
specs/capella/p2p-interface.md
"""
if len(self.md_doc_paths) == 0:
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)

Expand Down
Loading