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

Bellatrix Release Candidate (v1.2.0-rc.1) #2896

Merged
merged 135 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
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
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
c2ff094
Allow any non-merge block
paulhauner Mar 1, 2022
f071931
Address indenting
paulhauner Mar 1, 2022
4fbe162
Add on_attester_slashing() and related test
adiasg Mar 1, 2022
7f31c80
Fix lint & CI
adiasg Mar 1, 2022
70e8243
Update p2p-interface.md
nisdas Mar 2, 2022
bf25d32
Use merge consistently
paulhauner Mar 2, 2022
0b883a8
Merge pull request #2844 from sigp/opt-import
djrtwo Mar 3, 2022
37b8a89
Apply code review from @djrtwo
adiasg Mar 3, 2022
15a9040
minor comment change
djrtwo Mar 3, 2022
e1b9cf9
add withdrawal index to wihdrawal transaction
djrtwo Mar 3, 2022
1e10e7d
Fix UPDATE_TIMEOUT unit typo
adiasg Mar 4, 2022
75f94cb
Merge pull request #2848 from ethereum/fix-updatetimeout-typo
djrtwo Mar 4, 2022
a0ba6b2
Add note about syncing
adiasg Mar 8, 2022
0197a14
Merge pull request #2846 from nisdas/patch-2
djrtwo Mar 8, 2022
bd6d2ad
minor copy edit
djrtwo Mar 8, 2022
825a395
Merge pull request #2845 from ethereum/discard-equivocations
djrtwo Mar 8, 2022
95c7125
Fix `test_discard_equivocations` test vectors
hwwhww Mar 9, 2022
3cdc0e6
Add `on_attester_slashing` execution step
hwwhww Mar 9, 2022
8ec4773
EIP-4844: consensus layer changes
protolambda Mar 10, 2022
507f550
Merge branch 'dev' into withdrawals-push
djrtwo Mar 10, 2022
3dd83cf
minor withdrawals renamings
djrtwo Mar 10, 2022
84ab086
Add safe_block_hash to notify_fc_updated
mkalinin Mar 14, 2022
3458d12
Merge pull request #2849 from ethereum/yield-attester-slashing
hwwhww Mar 14, 2022
45e207b
EIP-4844 consensus-specs review fixes
protolambda Mar 14, 2022
9b760df
eip4844: beacon doc - update TOC
protolambda Mar 14, 2022
dc5f9df
eip4844: process_blob_kzgs - move TODO to issue, add missing input ar…
protolambda Mar 14, 2022
b8c061c
Merge pull request #2850 from protolambda/eip4844
djrtwo Mar 15, 2022
80292f7
Update specs/bellatrix/validator.md
djrtwo Mar 15, 2022
0afa7e1
update language to reflect latest work on withdrawals
ralexstokes Mar 16, 2022
cc347c6
Merge pull request #2851 from mkalinin/safe-head
mkalinin Mar 16, 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
79cdb88
wip 00 to 01 cred change
djrtwo Mar 16, 2022
36b0044
EIP4844: fix a minor typo
terencechain Mar 20, 2022
f5b5f63
Merge pull request #2857 from terencechain/patch-133
djrtwo Mar 21, 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
0da78eb
Merge branch 'withdrawals-push' into 00-to-01
djrtwo Mar 22, 2022
b469593
toc
djrtwo Mar 22, 2022
702ed9f
Merge branch 'withdrawals-push' into 00-to-01
djrtwo Mar 22, 2022
38496ba
toc
djrtwo Mar 22, 2022
199398c
Bellatrix: pass justified as a safe block
mkalinin Mar 22, 2022
d195e06
Fix toc
mkalinin Mar 22, 2022
95a2327
Bellatrix: add get_safe_block_hash to validator.md
mkalinin Mar 22, 2022
046eaf2
Bellatrix: remove a comment about safe head stub
mkalinin Mar 22, 2022
2017b61
test address_change
djrtwo Mar 22, 2022
4c89fdb
Fix indententation for one line in the Makefile
jtraglia Mar 22, 2022
8a388f2
toc
hwwhww Mar 23, 2022
2d0a306
Merge pull request #2860 from jtraglia/fix-makefile-indentation
hwwhww Mar 23, 2022
4ac4158
move bls chang operation to end of block body
djrtwo Mar 23, 2022
6e369e4
Apply suggestions from code review
djrtwo Mar 23, 2022
bc95973
Reorder params
mkalinin Mar 24, 2022
c97cc6f
Add separate get_safe_beacon_block function
mkalinin Mar 24, 2022
ee5f29c
fix ci
djrtwo Mar 24, 2022
656e6ae
Merge pull request #2836 from ethereum/withdrawals-push
djrtwo Mar 24, 2022
bd66114
Clarify names and move get_safe_block_hash to safe-block.md
mkalinin Mar 25, 2022
19613ac
Merge pull request #2854 from ralexstokes/update-0x01-creds
djrtwo Mar 25, 2022
eb26a1d
EIP4844: fix a minor typo
terencechain Mar 26, 2022
70aba23
Merge pull request #2863 from terencechain/patch-134
hwwhww Mar 29, 2022
b13a9f0
Apply suggestions as per review
mkalinin Mar 30, 2022
c87fc48
minor typo
djrtwo Mar 30, 2022
1bfefe3
Merge pull request #2858 from mkalinin/justified-to-safe-block
djrtwo Mar 30, 2022
6576cab
Fix Capella `prepare_execution_payload`
hwwhww Apr 6, 2022
5978c86
Typo fix: `ksg_to_version_hash` -> `kzg_to_versioned_hash`
hwwhww Apr 10, 2022
49e4b2b
Merge pull request #2868 from ethereum/fix-capella-validator
hwwhww Apr 12, 2022
dcf41ef
Merge branch 'dev' into eip4844-typo
hwwhww Apr 12, 2022
eca7237
Correct typo: BLSCommitment -> KZGCommitment
benjaminion Apr 13, 2022
f8bf3d3
Merge pull request #2870 from ethereum/eip4844-typo
hwwhww Apr 17, 2022
83ac38c
Merge pull request #2872 from benjaminion/patch-1
hwwhww Apr 17, 2022
f125538
Fix param order in `prepare_execution_payload`
etan-status Apr 25, 2022
b9cb294
Yield attestation in equivocating indices test
zilm13 Apr 25, 2022
706f417
Remove justified from optimistic import conditions
mkalinin Apr 28, 2022
83bf20c
Merge pull request #2881 from ethereum/mkalinin-patch-2
mkalinin Apr 29, 2022
9e09e96
Merge pull request #2876 from etan-status/fix-prepare-payload
hwwhww May 3, 2022
8a4ea1d
Merge pull request #2877 from zilm13/fix/equivocating-indices
hwwhww May 3, 2022
3f76792
Require fork choice to run before proposal
michaelsproul May 5, 2022
c1d0836
Merge pull request #2855 from ethereum/00-to-01
djrtwo May 5, 2022
3c7544a
Add invalid large withdrawable epoch test
jtraglia May 6, 2022
f5303ca
Update PROPOSER_SCORE_BOOST to 33 percent
casparschwa May 9, 2022
712a4f9
Fix linting
casparschwa May 9, 2022
a7bda48
Convert sets to sorted lists prior to sampling
jtraglia May 9, 2022
9dcb2ee
Fix linter warnings
jtraglia May 9, 2022
90c1825
Convert participation_fn from lambda to def
jtraglia May 9, 2022
e2cbdb2
Move test case to new location
jtraglia May 9, 2022
ac7267c
Fix linter warnings again
jtraglia May 9, 2022
96de0fe
Merge pull request #2889 from jtraglia/remove-set-sampling
hwwhww May 10, 2022
242f286
Merge pull request #2878 from michaelsproul/forkchoice-b4-propose
djrtwo May 10, 2022
c0a8178
minor patch to bytes formatting in capella
djrtwo May 10, 2022
8abf239
Merge pull request #2890 from ethereum/format
hwwhww May 10, 2022
5868a53
Revert "Fix linter warnings again"
jtraglia May 10, 2022
d1f0187
Revert "Move test case to new location"
jtraglia May 10, 2022
02090d9
Remove pytest import
jtraglia May 10, 2022
89e7a10
Add notes about invalid case to `epoch_processing` test format
hwwhww May 10, 2022
08db749
Optimistic Sync: remove INVALID_TERMINAL_BLOCK
mkalinin May 13, 2022
8c0ca37
Merge pull request #2891 from ethereum/mkalinin-patch-2
djrtwo May 13, 2022
ec7bb23
bellatrix-p2p: fix a typo
terencechain May 14, 2022
87991c8
bump milagro bls version
ChihChengLiang May 14, 2022
b7eff21
Merge pull request #2892 from terencechain/patch-135
ralexstokes May 14, 2022
30a3326
Merge pull request #2893 from ChihChengLiang/bump-milagro-version
ralexstokes May 14, 2022
af1fbab
Merge pull request #2888 from casparschwa/update-proposer-score-boost
djrtwo May 16, 2022
1d82d33
Merge pull request #2887 from jtraglia/add-invalid-withdrawable-epoch…
djrtwo May 16, 2022
20a90f1
Add new `DomainType` for application usage (#2884)
ralexstokes May 16, 2022
bab5e40
Ignore subset aggregates (#2847)
arnetheduck May 17, 2022
5337da5
use python syntax for bitwise AND operation (#2894)
ralexstokes May 17, 2022
d62ebae
Run on_tick before picking the head for proposal (#2897)
mkalinin May 19, 2022
b23cdef
Remove API restrictions for optimistic sync (#2869)
paulhauner May 19, 2022
72f7b88
Update PROPOSER_SCORE_BOOST to 40 percent (#2895)
casparschwa May 20, 2022
0e6a7cd
deprecate `BeaconBlocksByRange.step` (#2856)
arnetheduck May 20, 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
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ 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)
$(wildcard $(SPEC_DIR)/sharding/*.md) \
$(wildcard $(SPEC_DIR)/eip4844/*.md)

COV_HTML_OUT=.htmlcov
COV_HTML_OUT_DIR=$(PY_SPEC_DIR)/$(COV_HTML_OUT)
Expand Down Expand Up @@ -67,7 +69,7 @@ partial_clean:

clean: partial_clean
rm -rf venv
# legacy cleanup. The pyspec venv should be located at the repository root
# legacy cleanup. The pyspec venv should be located at the repository root
rm -rf $(PY_SPEC_DIR)/venv
rm -rf $(DEPOSIT_CONTRACT_COMPILER_DIR)/venv
rm -rf $(DEPOSIT_CONTRACT_TESTER_DIR)/venv
Expand Down Expand Up @@ -97,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 @@ -135,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
11 changes: 8 additions & 3 deletions 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 Expand Up @@ -79,8 +84,8 @@ CHURN_LIMIT_QUOTIENT: 65536

# Fork choice
# ---------------------------------------------------------------
# 70%
PROPOSER_SCORE_BOOST: 70
# 40%
PROPOSER_SCORE_BOOST: 40

# Deposit contract
# ---------------------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions 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 Expand Up @@ -78,8 +81,8 @@ CHURN_LIMIT_QUOTIENT: 32

# Fork choice
# ---------------------------------------------------------------
# 70%
PROPOSER_SCORE_BOOST: 70
# 40%
PROPOSER_SCORE_BOOST: 40


# Deposit contract
Expand Down
48 changes: 48 additions & 0 deletions fork_choice/safe-block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Fork Choice -- Safe Block

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

- [Introduction](#introduction)
- [`get_safe_beacon_block_root`](#get_safe_beacon_block_root)
- [`get_safe_execution_payload_hash`](#get_safe_execution_payload_hash)

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

## Introduction

Under honest majority and certain network synchronicity assumptions
there exist a block that is safe from re-orgs. Normally this block is
pretty close to the head of canonical chain which makes it valuable
to expose a safe block to users.

This section describes an algorithm to find a safe block.

## `get_safe_beacon_block_root`

```python
def get_safe_beacon_block_root(store: Store) -> Root:
# Use most recent justified block as a stopgap
return store.justified_checkpoint.root
```
*Note*: Currently safe block algorithm simply returns `store.justified_checkpoint.root`
and is meant to be improved in the future.

## `get_safe_execution_payload_hash`

```python
def get_safe_execution_payload_hash(store: Store) -> Hash32:
safe_block_root = get_safe_beacon_block_root(store)
safe_block = store.blocks[safe_block_root]

# Return Hash32() if no payload is yet justified
if compute_epoch_at_slot(safe_block.slot) >= BELLATRIX_FORK_EPOCH:
return safe_block.body.execution_payload.block_hash
else:
return Hash32()
```

*Note*: This helper uses beacon block container extended in [Bellatrix](../specs/bellatrix/beacon-chain.md).
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
47 changes: 39 additions & 8 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 @@ -529,6 +534,7 @@ def notify_new_payload(self: ExecutionEngine, execution_payload: ExecutionPayloa

def notify_forkchoice_updated(self: ExecutionEngine,
head_block_hash: Hash32,
safe_block_hash: Hash32,
finalized_block_hash: Hash32,
payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]:
pass
Expand All @@ -548,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 @@ -683,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 @@ -709,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 @@ -799,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 @@ -846,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 @@ -862,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 Expand Up @@ -1017,7 +1048,7 @@ def run(self):
"eth-typing>=2.1.0,<3.0.0",
"pycryptodome==3.9.4",
"py_ecc==5.2.0",
"milagro_bls_binding==1.6.3",
"milagro_bls_binding==1.9.0",
"dataclasses==0.6",
"remerkleable==0.1.24",
RUAMEL_YAML_VERSION,
Expand Down
1 change: 1 addition & 0 deletions specs/altair/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def get_sync_subcommittee_pubkeys(state: BeaconState, subcommittee_index: uint64
- _[REJECT]_ `contribution_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_sync_committee_aggregator(contribution_and_proof.selection_proof)` returns `True`.
- _[REJECT]_ The aggregator's validator index is in the declared subcommittee of the current sync committee --
i.e. `state.validators[contribution_and_proof.aggregator_index].pubkey in get_sync_subcommittee_pubkeys(state, contribution.subcommittee_index)`.
- _[IGNORE]_ A valid sync committee contribution with equal `slot`, `beacon_block_root` and `subcommittee_index` whose `aggregation_bits` is non-strict superset has _not_ already been seen.
- _[IGNORE]_ The sync committee contribution is the first valid contribution received for the aggregator with index `contribution_and_proof.aggregator_index`
for the slot `contribution.slot` and subcommittee index `contribution.subcommittee_index`
(this requires maintaining a cache of size `SYNC_COMMITTEE_SIZE` for this topic that can be flushed after each slot).
Expand Down
2 changes: 1 addition & 1 deletion specs/altair/sync-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ uses sync committees introduced in [this beacon chain extension](./beacon-chain.
| Name | Value | Unit | Duration |
| - | - | - | - |
| `MIN_SYNC_COMMITTEE_PARTICIPANTS` | `1` | validators |
| `UPDATE_TIMEOUT` | `SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD` | epochs | ~27.3 hours |
| `UPDATE_TIMEOUT` | `SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD` | slots | ~27.3 hours |

## Containers

Expand Down
12 changes: 10 additions & 2 deletions specs/bellatrix/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Protocols](#protocols)
- [`ExecutionEngine`](#executionengine)
- [`notify_forkchoice_updated`](#notify_forkchoice_updated)
- [`safe_block_hash`](#safe_block_hash)
- [Helpers](#helpers)
- [`PayloadAttributes`](#payloadattributes)
- [`PowBlock`](#powblock)
Expand Down Expand Up @@ -47,8 +48,9 @@ The Engine API may be used to implement it with an external execution engine.

#### `notify_forkchoice_updated`

This function performs two actions *atomically*:
This function performs three actions *atomically*:
* Re-organizes the execution payload chain and corresponding state to make `head_block_hash` the head.
* Updates safe block hash with the value provided by `safe_block_hash` parameter.
* Applies finality to the execution state: it irreversibly persists the chain of all execution payloads
and corresponding state, up to and including `finalized_block_hash`.

Expand All @@ -58,18 +60,24 @@ Additionally, if `payload_attributes` is provided, this function sets in motion
```python
def notify_forkchoice_updated(self: ExecutionEngine,
head_block_hash: Hash32,
safe_block_hash: Hash32,
finalized_block_hash: Hash32,
payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]:
...
```

*Note*: The call of the `notify_forkchoice_updated` function maps on the `POS_FORKCHOICE_UPDATED` event defined in the [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#definitions).
*Note*: The `(head_block_hash, finalized_block_hash)` values of the `notify_forkchoice_updated` function call maps on the `POS_FORKCHOICE_UPDATED` event defined in the [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#definitions).
As per EIP-3675, before a post-transition block is finalized, `notify_forkchoice_updated` MUST be called with `finalized_block_hash = Hash32()`.

*Note*: Client software MUST NOT call this function until the transition conditions are met on the PoW network, i.e. there exists a block for which `is_valid_terminal_pow_block` function returns `True`.

*Note*: Client software MUST call this function to initiate the payload build process to produce the merge transition block; the `head_block_hash` parameter MUST be set to the hash of a terminal PoW block in this case.

##### `safe_block_hash`

The `safe_block_hash` parameter MUST be set to return value of
[`get_safe_execution_payload_hash(store: Store)`](../../fork_choice/safe-block.md#get_safe_execution_payload_hash) function.

## Helpers

### `PayloadAttributes`
Expand Down
Loading