Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ categories:
labels:
- gloas
- eip7732
- eip7928

# Features
- title: EIP-6110
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- fulu
- gloas
- eip7805
- eip7928
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- fulu
- gloas
- eip7805
- eip7928
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tests/core/pyspec/eth2spec/gloas/
tests/core/pyspec/eth2spec/eip6800/
tests/core/pyspec/eth2spec/eip7441/
tests/core/pyspec/eth2spec/eip7805/
tests/core/pyspec/eth2spec/eip7928/

# coverage reports
.htmlcov
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ALL_EXECUTABLE_SPEC_NAMES = \
gloas \
eip6800 \
eip7441 \
eip7805
eip7805 \
eip7928

# A list of fake targets.
.PHONY: \
Expand Down
3 changes: 3 additions & 0 deletions configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ EIP7441_FORK_EPOCH: 18446744073709551615
# EIP7805
EIP7805_FORK_VERSION: 0x0a000000 # temporary stub
EIP7805_FORK_EPOCH: 18446744073709551615
# EIP7928
EIP7928_FORK_VERSION: 0x0b000000 # temporary stub
EIP7928_FORK_EPOCH: 18446744073709551615

# Time parameters
# ---------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ EIP7441_FORK_EPOCH: 18446744073709551615
# [customized] EIP7805
EIP7805_FORK_VERSION: 0x0a000001
EIP7805_FORK_EPOCH: 18446744073709551615
# [customized] EIP7928
EIP7928_FORK_VERSION: 0x0b000001
EIP7928_FORK_EPOCH: 18446744073709551615

# Time parameters
# ---------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions pysetup/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
EIP6800 = "eip6800"
EIP7441 = "eip7441"
EIP7805 = "eip7805"
EIP7928 = "eip7928"


# The helper functions that are used when defining constants
Expand Down
2 changes: 2 additions & 0 deletions pysetup/md_doc_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
EIP6800,
EIP7441,
EIP7805,
EIP7928,
ELECTRA,
FULU,
GLOAS,
Expand All @@ -26,6 +27,7 @@
EIP6800: DENEB,
EIP7441: CAPELLA,
EIP7805: FULU,
EIP7928: FULU,
}

ALL_FORKS = list(PREVIOUS_FORK_OF.keys())
Expand Down
2 changes: 2 additions & 0 deletions pysetup/spec_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .eip6800 import EIP6800SpecBuilder
from .eip7441 import EIP7441SpecBuilder
from .eip7805 import EIP7805SpecBuilder
from .eip7928 import EIP7928SpecBuilder
from .electra import ElectraSpecBuilder
from .fulu import FuluSpecBuilder
from .gloas import GloasSpecBuilder
Expand All @@ -24,5 +25,6 @@
EIP6800SpecBuilder,
EIP7441SpecBuilder,
EIP7805SpecBuilder,
EIP7928SpecBuilder,
)
}
12 changes: 12 additions & 0 deletions pysetup/spec_builders/eip7928.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from ..constants import EIP7928
from .base import BaseSpecBuilder


class EIP7928SpecBuilder(BaseSpecBuilder):
fork: str = EIP7928

@classmethod
def imports(cls, preset_name: str):
return f"""
from eth2spec.fulu import {preset_name} as fulu
"""
147 changes: 147 additions & 0 deletions specs/_features/eip7928/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# EIP-7928 -- The Beacon Chain

*Note*: This document is a work-in-progress for researchers and implementers.

<!-- mdformat-toc start --slug=github --no-anchors --maxlevel=6 --minlevel=2 -->

- [Introduction](#introduction)
- [Custom types](#custom-types)
- [Extended Containers](#extended-containers)
- [`ExecutionPayload`](#executionpayload)
- [`ExecutionPayloadHeader`](#executionpayloadheader)
- [`NewPayloadRequest`](#newpayloadrequest)
- [Beacon chain state transition function](#beacon-chain-state-transition-function)
- [Block processing](#block-processing)
- [Execution payload](#execution-payload)
- [Modified `process_execution_payload`](#modified-process_execution_payload)

<!-- mdformat-toc end -->

## Introduction

*Note*: This specification is built upon [Fulu](../../fulu/beacon-chain.md) and
is under active development.

## Custom types

| Name | SSZ equivalent | Description |
| ----------------- | ------------------------------------- | ----------------------------- |
| `BlockAccessList` | `ByteList[MAX_BYTES_PER_TRANSACTION]` | RLP encoded block access list |

## Extended Containers

### `ExecutionPayload`

```python
class ExecutionPayload(Container):
parent_hash: Hash32
fee_recipient: ExecutionAddress
state_root: Bytes32
receipts_root: Bytes32
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
prev_randao: Bytes32
block_number: uint64
gas_limit: uint64
gas_used: uint64
timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: uint256
block_hash: Hash32
transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
blob_gas_used: uint64
excess_blob_gas: uint64
# [New in EIP7928]
block_access_list: BlockAccessList
```

### `ExecutionPayloadHeader`

```python
class ExecutionPayloadHeader(Container):
parent_hash: Hash32
fee_recipient: ExecutionAddress
state_root: Bytes32
receipts_root: Bytes32
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
prev_randao: Bytes32
block_number: uint64
gas_limit: uint64
gas_used: uint64
timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: uint256
block_hash: Hash32
transactions_root: Root
withdrawals_root: Root
blob_gas_used: uint64
excess_blob_gas: uint64
# [New in EIP7928]
block_access_list_root: Root
```

### `NewPayloadRequest`

*Note*: The `NewPayloadRequest` is unchanged. The `block_access_list` is
included in the `execution_payload` field.

## Beacon chain state transition function

### Block processing

#### Execution payload

##### Modified `process_execution_payload`

```python
def process_execution_payload(
state: BeaconState, body: BeaconBlockBody, execution_engine: ExecutionEngine
) -> None:
payload = body.execution_payload

# Verify consistency of the parent hash with respect to the previous execution payload header
assert payload.parent_hash == state.latest_execution_payload_header.block_hash
# Verify prev_randao
assert payload.prev_randao == get_randao_mix(state, get_current_epoch(state))
# Verify timestamp
assert payload.timestamp == compute_time_at_slot(state, state.slot)
# Verify commitments are under limit
assert (
len(body.blob_kzg_commitments)
<= get_blob_parameters(get_current_epoch(state)).max_blobs_per_block
)
# Verify the execution payload is valid
versioned_hashes = [
kzg_commitment_to_versioned_hash(commitment) for commitment in body.blob_kzg_commitments
]
assert execution_engine.verify_and_notify_new_payload(
NewPayloadRequest(
execution_payload=payload,
versioned_hashes=versioned_hashes,
parent_beacon_block_root=state.latest_block_header.parent_root,
execution_requests=body.execution_requests,
)
)
# Cache execution payload header
state.latest_execution_payload_header = ExecutionPayloadHeader(
parent_hash=payload.parent_hash,
fee_recipient=payload.fee_recipient,
state_root=payload.state_root,
receipts_root=payload.receipts_root,
logs_bloom=payload.logs_bloom,
prev_randao=payload.prev_randao,
block_number=payload.block_number,
gas_limit=payload.gas_limit,
gas_used=payload.gas_used,
timestamp=payload.timestamp,
extra_data=payload.extra_data,
base_fee_per_gas=payload.base_fee_per_gas,
block_hash=payload.block_hash,
transactions_root=hash_tree_root(payload.transactions),
withdrawals_root=hash_tree_root(payload.withdrawals),
blob_gas_used=payload.blob_gas_used,
excess_blob_gas=payload.excess_blob_gas,
# [New in EIP7928]
block_access_list_root=hash_tree_root(payload.block_access_list),
)
```
111 changes: 111 additions & 0 deletions specs/_features/eip7928/fork.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# EIP-7928 -- Fork Logic

*Note*: This document is a work-in-progress for researchers and implementers.

<!-- mdformat-toc start --slug=github --no-anchors --maxlevel=6 --minlevel=2 -->

- [Introduction](#introduction)
- [Configuration](#configuration)
- [Fork to EIP-7928](#fork-to-eip-7928)
- [Fork trigger](#fork-trigger)
- [Upgrading the state](#upgrading-the-state)

<!-- mdformat-toc end -->

## Introduction

This document describes the process of the EIP-7928 upgrade.

## Configuration

Warning: this configuration is not definitive.

| Name | Value |
| ---------------------- | ------------------------------------- |
| `EIP7928_FORK_VERSION` | `Version('0x0b000000')` |
| `EIP7928_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |

## Fork to EIP-7928

### Fork trigger

The fork is triggered at epoch `EIP7928_FORK_EPOCH`.

### Upgrading the state

If `state.slot % SLOTS_PER_EPOCH == 0` and
`compute_epoch_at_slot(state.slot) == EIP7928_FORK_EPOCH`, an irregular state
change is made to upgrade to EIP-7928.

```python
def upgrade_to_eip7928(pre: fulu.BeaconState) -> BeaconState:
epoch = get_current_epoch(pre)
latest_execution_payload_header = ExecutionPayloadHeader(
parent_hash=pre.latest_execution_payload_header.parent_hash,
fee_recipient=pre.latest_execution_payload_header.fee_recipient,
state_root=pre.latest_execution_payload_header.state_root,
receipts_root=pre.latest_execution_payload_header.receipts_root,
logs_bloom=pre.latest_execution_payload_header.logs_bloom,
prev_randao=pre.latest_execution_payload_header.prev_randao,
block_number=pre.latest_execution_payload_header.block_number,
gas_limit=pre.latest_execution_payload_header.gas_limit,
gas_used=pre.latest_execution_payload_header.gas_used,
timestamp=pre.latest_execution_payload_header.timestamp,
extra_data=pre.latest_execution_payload_header.extra_data,
base_fee_per_gas=pre.latest_execution_payload_header.base_fee_per_gas,
block_hash=pre.latest_execution_payload_header.block_hash,
transactions_root=pre.latest_execution_payload_header.transactions_root,
withdrawals_root=pre.latest_execution_payload_header.withdrawals_root,
blob_gas_used=pre.latest_execution_payload_header.blob_gas_used,
excess_blob_gas=pre.latest_execution_payload_header.excess_blob_gas,
# [New in EIP7928]
block_access_list_root=Root(),
)
post = BeaconState(
genesis_time=pre.genesis_time,
genesis_validators_root=pre.genesis_validators_root,
slot=pre.slot,
fork=Fork(
previous_version=pre.fork.current_version,
# [Modified in EIP7928]
current_version=EIP7928_FORK_VERSION,
epoch=epoch,
),
latest_block_header=pre.latest_block_header,
block_roots=pre.block_roots,
state_roots=pre.state_roots,
historical_roots=pre.historical_roots,
eth1_data=pre.eth1_data,
eth1_data_votes=pre.eth1_data_votes,
eth1_deposit_index=pre.eth1_deposit_index,
validators=pre.validators,
balances=pre.balances,
randao_mixes=pre.randao_mixes,
slashings=pre.slashings,
previous_epoch_participation=pre.previous_epoch_participation,
current_epoch_participation=pre.current_epoch_participation,
justification_bits=pre.justification_bits,
previous_justified_checkpoint=pre.previous_justified_checkpoint,
current_justified_checkpoint=pre.current_justified_checkpoint,
finalized_checkpoint=pre.finalized_checkpoint,
inactivity_scores=pre.inactivity_scores,
current_sync_committee=pre.current_sync_committee,
next_sync_committee=pre.next_sync_committee,
latest_execution_payload_header=latest_execution_payload_header,
next_withdrawal_index=pre.next_withdrawal_index,
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
historical_summaries=pre.historical_summaries,
deposit_requests_start_index=pre.deposit_requests_start_index,
deposit_balance_to_consume=pre.deposit_balance_to_consume,
exit_balance_to_consume=pre.exit_balance_to_consume,
earliest_exit_epoch=pre.earliest_exit_epoch,
consolidation_balance_to_consume=pre.consolidation_balance_to_consume,
earliest_consolidation_epoch=pre.earliest_consolidation_epoch,
pending_deposits=pre.pending_deposits,
pending_partial_withdrawals=pre.pending_partial_withdrawals,
pending_consolidations=pre.pending_consolidations,
proposer_lookahead=pre.proposer_lookahead,
)

return post
```
Loading