Skip to content

Commit b3e83f6

Browse files
authored
Merge pull request #4119 from ethereum/dev
Release v1.5.0-beta.2
2 parents 385efd7 + 6803ea3 commit b3e83f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1631
-67
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ commands:
3636
steps:
3737
- restore_cached_venv:
3838
venv_name: v33-pyspec
39-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}
39+
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}-{{ python3 --version }}
4040
save_pyspec_cached_venv:
4141
description: Save a venv into a cache with pyspec keys"
4242
steps:
4343
- save_cached_venv:
4444
venv_name: v33-pyspec
45-
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}
45+
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}-{{ python3 --version }}
4646
venv_path: ./venv
4747
jobs:
4848
checkout_specs:

.github/workflows/generate_vectors.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717

1818
jobs:
1919
generate-tests:
20+
timeout-minutes: 720 # 12 hours
2021
runs-on: [self-hosted-ghr-custom, size-xl-x64, profile-consensusSpecs]
2122
steps:
2223
- name: Checkout repository
@@ -25,12 +26,6 @@ jobs:
2526
repository: 'ethereum/consensus-specs'
2627
path: 'consensus-specs'
2728
ref: ${{ inputs.ref || 'dev' }}
28-
- name: Checkout consensus-spec-tests repository
29-
uses: actions/checkout@v4
30-
with:
31-
repository: 'ethereum/consensus-spec-tests'
32-
path: 'consensus-spec-tests'
33-
fetch-depth: 1
3429
- name: Setup Python
3530
uses: actions/setup-python@v5
3631
with:
@@ -39,7 +34,7 @@ jobs:
3934
- name: Generate tests
4035
run: |
4136
cd consensus-specs
42-
make -j 16 gen_all 2>&1 | tee ../consensustestgen.log
37+
make -j$(nproc) gen_all 2>&1 | tee ../consensustestgen.log
4338
cp -r presets/ ../consensus-spec-tests/presets
4439
cp -r configs/ ../consensus-spec-tests/configs
4540
find . -type d -empty -delete
@@ -78,4 +73,4 @@ jobs:
7873
uses: actions/upload-artifact@v4
7974
with:
8075
name: consensustestgen.log
81-
path: consensustestgen.log
76+
path: consensustestgen.log

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ PYSPEC_DIR = $(TEST_LIBS_DIR)/pyspec
7474
# Create the pyspec for all phases.
7575
pyspec: $(VENV) setup.py pyproject.toml
7676
@echo "Building eth2spec"
77-
@$(PYTHON_VENV) -m uv pip install .[docs,lint,test,generator]
77+
@$(PYTHON_VENV) -m uv pip install --reinstall-package=eth2spec .[docs,lint,test,generator]
7878
@echo "Building all pyspecs"
7979
@$(PYTHON_VENV) setup.py pyspecdev
8080

README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ To learn more about proof-of-stake and sharding, see the [PoS documentation](htt
66

77
This repository hosts the current Ethereum proof-of-stake specifications. Discussions about design rationale and proposed changes can be brought up and discussed as issues. Solidified, agreed-upon changes to the spec can be made through pull requests.
88

9-
## Specs
9+
## Specifications
1010

1111
[![GitHub release](https://img.shields.io/github/v/release/ethereum/consensus-specs)](https://github.com/ethereum/consensus-specs/releases/) [![PyPI version](https://badge.fury.io/py/eth2spec.svg)](https://badge.fury.io/py/eth2spec) [![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)
1212

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

1616
### Stable Specifications
@@ -30,14 +30,6 @@ Features are researched and developed in parallel, and then consolidated into se
3030
| 5 | **Electra** | TBD | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/electra/beacon-chain.md)</li><li>[Electra fork](specs/electra/fork.md)</li></ul><li>Additions</li><ul><li>[Light client sync protocol changes](specs/electra/light-client/sync-protocol.md) ([fork](specs/electra/light-client/fork.md), [networking](specs/electra/light-client/p2p-interface.md))</li><li>[Honest validator guide changes](specs/electra/validator.md)</li><li>[P2P networking](specs/electra/p2p-interface.md)</li></ul></ul> |
3131
| 6 | **Fulu** | TBD | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/fulu/beacon-chain.md)</li><li>[Fulu fork](specs/fulu/fork.md)</li><li>[Data availability sampling core](specs/fulu/das-core.md)</li><li>[Polynomial commitments sampling](specs/fulu/polynomial-commitments-sampling.md)</li><li>[Fork choice changes](specs/fulu/fork-choice.md)</li></ul><li>Additions</li><ul><li>[P2P networking](specs/fulu/p2p-interface.md)</li><li>[Peer sampling](specs/fulu/peer-sampling.md)</li></ul></ul> |
3232

33-
### Outdated Specifications
34-
35-
| Code Name or Topic | Specs | Notes |
36-
| - | - | - |
37-
| Sharding | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/sharding/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[P2P networking](specs/_features/sharding/p2p-interface.md)</li></ul></ul> |
38-
| Custody Game | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/custody_game/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/_features/custody_game/validator.md)</li></ul></ul> | Dependent on sharding |
39-
| Data Availability Sampling | <ul><li>Core</li><ul><li>[Core types and functions](specs/_features/das/das-core.md)</li><li>[Fork choice changes](specs/_features/das/fork-choice.md)</li></ul><li>Additions</li><ul><li>[P2P Networking](specs/_features/das/p2p-interface.md)</li><li>[Sampling process](specs/_features/das/sampling.md)</li></ul></ul> | <ul><li> Dependent on sharding</li><li>[Technical explainer](https://hackmd.io/@HWeNw8hNRimMm2m2GH56Cw/B1YJPGkpD)</li></ul> |
40-
4133
### Accompanying documents can be found in [specs](specs) and include:
4234

4335
* [SimpleSerialize (SSZ) spec](ssz/simple-serialize.md)
@@ -50,7 +42,7 @@ Additional specifications and standards outside of requisite client functionalit
5042

5143
* [Beacon APIs](https://github.com/ethereum/beacon-apis)
5244
* [Engine APIs](https://github.com/ethereum/execution-apis/tree/main/src/engine)
53-
* [Beacon Metrics](https://github.com/ethereum/beacon-metrics/)
45+
* [Beacon Metrics](https://github.com/ethereum/beacon-metrics)
5446

5547
## Design goals
5648

@@ -81,7 +73,8 @@ Documentation on the different components used during spec writing can be found
8173

8274
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).
8375

84-
## Installation and Usage
76+
## Installation and usage
77+
8578
The consensus-specs repo can be used by running the tests locally or inside a docker container.
8679

8780
To run the tests locally:

configs/mainnet.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
170170
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
171171
SAMPLES_PER_SLOT: 8
172172
CUSTODY_REQUIREMENT: 4
173+
VALIDATOR_CUSTODY_REQUIREMENT: 8
174+
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
173175
MAX_BLOBS_PER_BLOCK_FULU: 12
174176
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
175177

configs/minimal.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
171171
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
172172
SAMPLES_PER_SLOT: 8
173173
CUSTODY_REQUIREMENT: 4
174+
VALIDATOR_CUSTODY_REQUIREMENT: 8
175+
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
174176
MAX_BLOBS_PER_BLOCK_FULU: 12
175177
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
176178

specs/electra/beacon-chain.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,9 @@ def process_registry_updates(state: BeaconState) -> None:
830830
for index, validator in enumerate(state.validators):
831831
if is_eligible_for_activation_queue(validator): # [Modified in Electra:EIP7251]
832832
validator.activation_eligibility_epoch = current_epoch + 1
833-
834-
if is_active_validator(validator, current_epoch) and validator.effective_balance <= EJECTION_BALANCE:
833+
elif is_active_validator(validator, current_epoch) and validator.effective_balance <= EJECTION_BALANCE:
835834
initiate_validator_exit(state, ValidatorIndex(index)) # [Modified in Electra:EIP7251]
836-
837-
if is_eligible_for_activation(state, validator):
835+
elif is_eligible_for_activation(state, validator):
838836
validator.activation_epoch = activation_epoch
839837
```
840838

specs/electra/validator.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,40 @@ def get_eth1_pending_deposit_count(state: BeaconState) -> uint64:
153153
return uint64(0)
154154
```
155155

156+
*Note*: Clients will be able to remove the `Eth1Data` polling mechanism in an uncoordinated fashion once the transition period is finished. The transition period is considered finished when a network reaches the point where `state.eth1_deposit_index == state.deposit_requests_start_index`.
157+
158+
```python
159+
def get_eth1_vote(state: BeaconState, eth1_chain: Sequence[Eth1Block]) -> Eth1Data:
160+
# [New in Electra:EIP6110]
161+
if state.eth1_deposit_index == state.deposit_requests_start_index:
162+
return state.eth1_data
163+
164+
period_start = voting_period_start_time(state)
165+
# `eth1_chain` abstractly represents all blocks in the eth1 chain sorted by ascending block height
166+
votes_to_consider = [
167+
get_eth1_data(block) for block in eth1_chain
168+
if (
169+
is_candidate_block(block, period_start)
170+
# Ensure cannot move back to earlier deposit contract states
171+
and get_eth1_data(block).deposit_count >= state.eth1_data.deposit_count
172+
)
173+
]
174+
175+
# Valid votes already cast during this period
176+
valid_votes = [vote for vote in state.eth1_data_votes if vote in votes_to_consider]
177+
178+
# Default vote on latest eth1 block data in the period range unless eth1 chain is not live
179+
# Non-substantive casting for linter
180+
state_eth1_data: Eth1Data = state.eth1_data
181+
default_vote = votes_to_consider[len(votes_to_consider) - 1] if any(votes_to_consider) else state_eth1_data
182+
183+
return max(
184+
valid_votes,
185+
key=lambda v: (valid_votes.count(v), -valid_votes.index(v)), # Tiebreak by smallest distance
186+
default=default_vote
187+
)
188+
```
189+
156190
#### Execution payload
157191

158192
`prepare_execution_payload` is updated from the Deneb specs.

specs/fulu/das-core.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- [`get_data_column_sidecars`](#get_data_column_sidecars)
2626
- [Custody](#custody)
2727
- [Custody requirement](#custody-requirement)
28+
- [Validator custody](#validator-custody)
2829
- [Public, deterministic selection](#public-deterministic-selection)
2930
- [Custody sampling](#custody-sampling)
3031
- [Extended data](#extended-data)
@@ -72,6 +73,8 @@ The following values are (non-configurable) constants used throughout the specif
7273
| `SAMPLES_PER_SLOT` | `8` | Number of `DataColumnSidecar` random samples a node queries per slot |
7374
| `NUMBER_OF_CUSTODY_GROUPS` | `128` | Number of custody groups available for nodes to custody |
7475
| `CUSTODY_REQUIREMENT` | `4` | Minimum number of custody groups an honest node custodies and serves samples from |
76+
| `VALIDATOR_CUSTODY_REQUIREMENT` | `8` | Minimum number of custody groups an honest node with validators attached custodies and serves samples from |
77+
| `BALANCE_PER_ADDITIONAL_CUSTODY_GROUP` | `Gwei(32 * 10**9)` | Balance increment corresponding to one additional group to custody |
7578

7679
### Containers
7780

@@ -224,12 +227,25 @@ def get_data_column_sidecars(signed_block: SignedBeaconBlock,
224227

225228
### Custody requirement
226229

227-
Columns are grouped into custody groups. Nodes custodying a custody group MUST custody all the columns in that group.
230+
Columns are grouped into custody groups. Nodes custodying a custody group MUST custody all the columns in that group. When syncing, a node MUST backfill columns from all of its custody groups.
228231

229232
A node *may* choose to custody and serve more than the minimum honesty requirement. Such a node explicitly advertises a number greater than `CUSTODY_REQUIREMENT` through the peer discovery mechanism, specifically by setting a higher value in the `custody_group_count` field within its ENR. This value can be increased up to `NUMBER_OF_CUSTODY_GROUPS`, indicating a super-full node.
230233

231234
A node stores the custodied columns for the duration of the pruning period and responds to peer requests for samples on those columns.
232235

236+
### Validator custody
237+
238+
A node with validators attached downloads and custodies a higher minimum of custody groups per slot, determined by `get_validators_custody_requirement(state, validator_indices)`. Here, `state` is the current `BeaconState` and `validator_indices` is the list of indices corresponding to validators attached to the node. Any node with at least one validator attached, and with the sum of the balances of all attached validators being `total_node_balance`, downloads and custodies `total_node_balance // BALANCE_PER_ADDITIONAL_CUSTODY_GROUP` custody groups per slot, with a minimum of `VALIDATOR_CUSTODY_REQUIREMENT` and of course a maximum of `NUMBER_OF_CUSTODY_GROUPS`.
239+
240+
```python
241+
def get_validators_custody_requirement(state: BeaconState, validator_indices: Sequence[ValidatorIndex]) -> uint64:
242+
total_node_balance = sum(state.balances[index] for index in validator_indices)
243+
count = total_node_balance // BALANCE_PER_ADDITIONAL_CUSTODY_GROUP
244+
return min(max(count, VALIDATOR_CUSTODY_REQUIREMENT), NUMBER_OF_CUSTODY_GROUPS)
245+
```
246+
247+
This higher custody is advertised in the node's Metadata by setting a higher `custody_group_count` and in the node's ENR by setting a higher `cgc`. As with the regular custody requirement, a node with validators *may* still choose to custody, advertise and serve more than this minimum. As with the regular custody requirement, a node MUST backfill columns when syncing. In addition, when the validator custody requirement increases, due to an increase in the total balance of the attached validators, a node MUST backfill columns from the new custody groups. However, a node *may* wait to advertise a higher custody in its Metadata and ENR until backfilling is complete.
248+
233249
### Public, deterministic selection
234250

235251
The particular columns/groups that a node custodies are selected pseudo-randomly as a function (`get_custody_groups`) of the node-id and custody size -- importantly this function can be run by any party as the inputs are all public.

specs/fulu/fork.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def upgrade_to_fulu(pre: electra.BeaconState) -> BeaconState:
130130
earliest_exit_epoch=pre.earliest_exit_epoch,
131131
consolidation_balance_to_consume=pre.consolidation_balance_to_consume,
132132
earliest_consolidation_epoch=pre.earliest_consolidation_epoch,
133-
pending_balance_deposits=pre.pending_balance_deposits,
133+
pending_deposits=pre.pending_deposits,
134134
pending_partial_withdrawals=pre.pending_partial_withdrawals,
135135
pending_consolidations=pre.pending_consolidations,
136136
)

0 commit comments

Comments
 (0)